The very flawed concept of "Global Insurgency" has caused most to really mis-understand AQ in general, and AQI specifically.

It is far more accurate to look at AQ as a non-state organization that has no populace, but that through the power of the information tools of globalization is able to take advantage of a legal "sanctuary of status," as well as to a lesser degree sanctuary of poorly governed populaces and sanctuary of state borders to conduct a very state-like unconventional warfare campaign. This campaign is primarily to take down the Saudi Monarchy, but also other western legitimized governments of the region; with a secondary and supporting objective of breaking US support to the region in order to facilitate success of the primary objective.

So:

AQI is not part of the Iraqi Insurgency, they are there conducting UW to incite, guide, and support the Iraqi insurgency.

There are three general categories of insurgency, and all three existed in Iraq: Separatist (Kurd), revolutionary (Sunni), and resistance (Shia) in rough breakdown. None of these are AQ, and all are made up of Iraqis. Iran conducted UW as well in support of the Shia insurgency.

"Foreign fighters" in AQI are largely nationalist insurgents from Saudi Arabia, Syria, Yemen, Lybia, Algeria, and Morocco that want to change their own governance at home and who traveled to Iraq to support the second objective of breaking the US support to the region. Expect this brand of support to shift to Afghanistan along with the US. Where we go, they will go.

None of these are "Terrorists," though all use terrorist tactics. If you describe your foes by their purpose for action it is far easier to separate them and design effective tactics for dealing with each. If you conflate them all as "terrorists" you are just shooting your way into a quagmire. Similarly misrepresenting AQ as waging "global insurgency" confuses our solutions for dealing with them as well.