Back in the day, this was grounding. And instead of spiking it, QBs had to stand up real quick from center and throw it out of bounds. The changed the rule maybe for 2 reasons:
1) to make the game more competitive by giving the offense an easier way to stop the clock. Allowing a spike saves 1-2 seconds.
2) player safety. A QB is not going to get hurt spiking the ball. But in standing up right behind center and throwing out of bounds, the QB could get blind-sided by somebody jumping the snap and shooitng the gap or jumping over the center. I've never seen or heard about that happening, so this probably isn't the reason