Let us virtually consider the air as a set of particles, sound waves travel by repeating “compression” of the air, where air particles are distributed with high density, and “rarefaction” of the air, where air particles are distributed with low density. Therefore, it is called “compression wave.” Because directions of the displacement of air particles and the wave movement are the same, the sound wave is called “longitudinal wave.” When you grab one end of a rope swing it up an down, a “transverse wave” is created, and in this case, directions of the displacement and the wave movement are perpendicular.
The next video clip shows how a pulse travels from left to right, as a result of the red dot at the left end moving for a half period of its simple harmonic motion.
In this video, let us take a close look at the displacement of each dot when the pulse passing by. At the beginning, the displacement of each dot is 0. During the pulse is passing by, the displacement of each dot changes between 0 and 1.
What we can observe, if each dot moves right/left instead of up/down?
In the video above, the red dot moved towards right and back to the original position instead upwards/downwards, and it resulted a disturbance travels from left to right. (The number of dots in this video is reduced in half for easiness of view.)
Next, the red dot at the left end makes a simple harmonic motion, and as a result, a sinusoidal wave travels from left to right. While the displacement of each dot changes between -1 and +1, the wave travels perpendicularly; therefore it is a transverse wave.
Then, the direction of movement of each dot is now transfered and make each dot to move right/left. In this transformation, the upward movement is transfered into the rightward movement, and the downward movement is transfered into the leftward movement.
In this video clip, the directions of movement of each dot and the wave movement are the same, that is the longitudinal wave.