Why would Iran be complicit in the hijacking of a plane full of citizens from it's main petroleum buyer and major supplier of military technology?
Three possibilities, in no particular order.
1) Plausible deniability: Iran funds the terrorists under the table.
2) Iran is gambling that its connections with Russia will be better in the long run than its connections with Malaysia.
3) Religion trumps economics: the Iranian regime is Shi'a, the Malaysians are Sunni, and Iran is betting that Saudi Arabia won't get involved because the Saudis can't be sure they would have US backing.