Longitudinal wave is a kind of mechanical wave propagating in the medium, and its propagation direction is the same as the wave direction. In the process of longitudinal wave propagation, particles in the medium vibrate along the wave direction, that is, they bump up and down along the longitudinal direction.
This is because the propagation direction of the longitudinal wave is consistent with the free movement direction of the particles in the medium. The vibration force on the particles in the medium during the propagation of the longitudinal wave is in the longitudinal direction, so it vibrates in the longitudinal direction.
On the contrary, shear wave is a wave perpendicular to the propagation direction, and particles in the medium shake horizontally in the direction perpendicular to the propagation direction.
In a word, the vibration directions of longitudinal and transverse waves are determined by the propagation direction of waves and the properties of media.