Because the word عاصمة here is not to be considered alone, but it is in a genitive relation with العراق (hence in English they are connected by of).
In nouns compound or Genitive relations in Arabic, you add two words together one after the other. If the compound is to be indefinite, then simply no noun gets "AL" (the definite article الـ).
However, if the compound is to be defined, then the definite article AL is added to the SECOND word of the compound. Maybe it would be better with an example:
- a glass of water: كَأْسُ ماءٍ (ka'su má'in).
- the glass of water: كَأْسُ الماءِ (ka'su al-má'i).
In the sentence above, naturally Iraq is defined. Some country names in Arabic must come with the definite article but anyway that does not change anything. Say I need to say the capital of Canada then that would be عاصمة كندا - and I'm sure saying "a capital of Canada" wouldn't make much sense in English.