The Doppler effect changes observed frequency because of relative motion between the source and observer.
Christian Doppler described the phenomenon in 1842 while discussing how the color of light from moving stars might appear to change. The basic idea applies to any wave: when source and observer move toward one another, wavefronts arrive more frequently; when they separate, they arrive less frequently.
For sound, a passing siren is the familiar example. Its pitch sounds higher during approach and lower after it passes. Motion by either the source or the observer can produce the shift. With sound, motion relative to the surrounding medium also matters, while electromagnetic waves such as light do not require a material medium.
A common mix-up is confusing motion with the wave’s speed. The Doppler effect changes the measured frequency and wavelength, not the underlying propagation speed in a given medium. The shift also depends on the motion toward or away from the observer, called radial motion.