The Doppler effect occurs when the movement of an observer relative to a source causes a change in wavelength or frequency. Discovered by Austrian physicist Christian Doppler in 1803, this phenomenon is experienced in many different ways, such as when an ambulance passes you by and you hear an audible change in pitch.
One of the most common ways we experience the Doppler effect in action is the change in pitch caused by either a moving sound source around a stationary observer or a moving observer around a stationary sound source. When the sound source is stationary, the sound that we hear is at the same pitch as the sound emitted from the sound source.
When the sound source moves, the sound we perceive changes. Going back to the ambulance example, when an ambulance drives past us, the siren sounds different than it would if we were standing right next to it. The moving ambulance has a different pitch as it approaches, when it is closest to us, and as it passes us and drives away.
As the ambulance moves toward us, each successive sound wave is emitted from a closer position than that of the previous wave. Because of this change in position, each sound wave takes less time to reach us than the one before. The distance between wave crests (the wavelength) is thereby reduced, meaning that the perceived frequency of the wave increases and the sound is perceived to be of a higher pitch. Conversely, as a sound source moves away, waves are emitted from a source that is farther and farther away. This creates an increased wavelength, a decreased perceived frequency, and a lower pitch.
The situation is mirrored when we drive by the siren of an ambulance that is parked. In this instance, the observers (us) move toward the source (the siren) and the sound waves reach us from closer and closer positions as we move.
Source: https://en.wikipedia.org/wiki/Doppler_effect