If I understand correctly, Shiism only became majoritary in Iran from the rise of the Safavids in the 16th century. The Safavids promoted Shiism to distance themselves and their subjects from the rival Ottomans, who were Sunni.
From the 16th century onwards too, Iraq was most of the time ruled by the Ottomans. However, rather than Sunni-majority like the rest of Iraq (or the Ottomans themselves), southern Iraq is eminently Shiite today. Yet for most of the Middle Ages prior Iraq had been the center of a Sunni caliphate.
Why this apparent discrepancy?
Short version the people of Kufa didnt like uthman so they helped kill him and then to asked Ali the next in line to Caliph to protect them and he did from Muawiya who wanted revenge for the killing of Uthman. Muawiya then gets Ali killed and fights his son Hassan to become caliph. Basically it was politically convenient for them to support Ali. The word Shia come from means Faction of Ali