Here's why:
* Transverse waves have oscillations that are perpendicular to the direction the wave travels. Imagine the spring stretched out horizontally. When you push on it, you create a bump that travels down the spring. The particles of the spring move up and down (perpendicular to the direction of the wave), creating the wave pattern.
* Longitudinal waves have oscillations that are parallel to the direction the wave travels. Think of a slinky: when you push on it, the coils compress and expand, creating a wave that travels along the length of the slinky. The movement of the coils is in the same direction as the wave.
Since the spring's particles move up and down (perpendicular to the wave's direction), the wave created is a transverse wave.