The Doppler effect is a physical phenomenon that alters the emitted frequencies of radiation from distant objects when the observer are approaching them with high speed.
Every ambulance or fast-moving, sound-producing vehicle has a switch inside which changes the pitch of the sound. As the driver passes you, he or she flips the switch and creates the illusion. This requires split-second timing on the part of all people who own vehicles, but it is necessary to maintain the Truman-show style illusion that surrounds you (yes, you) every moment of your waking life. For all normal people, ambulance sirens do not change pitch when they drive past.