Because Hidden Power is determined by IVs. If your SAtk IVs were 31, your Hidden Power would be a different type.
EDIT: I don't think you understand. The IVs determine that, only specifric IVs will get you Hidden Power Grass. When you selected Hidden Power Grass, it automatically changed your IVs so that they would make Hidden Power a Grass type move.