These two images probably explain it best:

This is a map from the US Geological Survey Earthquake Hazards Program, which shows all recorded large earthquakes in the region from 1900 to March 2012.
The black lines are tectonic plate boundaries. The plate in the middle is the Arabian Plate. The current movement of that plate is show in this image from mediawiki:

So the Arabian plate is currently pushing north against the Eurasian plate, and sliding under it, causing uplift in Iran, and probably causing various slip and thrust fault lines. The pressure on those fault lines is released as earthquakes.
Iraq is not so affected, because it is on the plate. Maybe it will be in a few hundred thousand years :)