We have heard an ambulance sirens and felt that the ambulance is getting closer. When the ambulance approaches, the sirens sound higher, and when they move away, the sirens sound lower. That is, when an ambulance approaches with a siren, the wavelength of the sound wave becomes shorter (higher sound), and when it moves away, the wavelength of the sound wave becomes longer (lower sound).
Similar effects are seen in light. When the star moves away from the earth, the wavelength of the starlight is longer than it originally was, and the spectrum of the starlight appears to be red. Scientists have analyzed the spectrum of light coming from outer galaxies to find out that the universe is expanding.