Imagine a sinusoidal sound wave of certain frequency is propagating in some direction along a straight line. If you are standing still you will experience f periods per second (where f is the frequency in Hz) and hear an appropriate sound (assume this frequency is in audio range).
Now suppose you were to move away from this sound's source at some speed v, which just happens to equal the speed of this source's sound wave propagation and suppose you started this movement before it ever reached you. Now since you both have the same speed, the wave will never reach you and you will never hear it.
Now suppose you move away at speed of only 1/2 of the wave's speed. Now the wave will catch up to you, but because you keep moving away, wave's speed relative to you is only 1/2 of what it used to be so now you will experience only f/2 periods per second. Thus you experience a frequency that is f/2 (not f) and will hear a different sound than what a stationary person will.
Now suppose you move toward the sound source at a speed equal to the wave's speed. Now the wave will not only catch up to you but will go through you faster because its effective speed toward you is now double what it used to be. This means 2f periods will go through you per second and you will hear a higher pitch noise than if you were standing.
This concept is not unique to sound. It works with any periodic wave motion where a "target" is in motion relative to the source and experiences a different frequency than the source's original frequency.
the OBSERVED frequency changes depending on which way the source or detector is moving. when the source is moving towards a stationary detector (think about the waves being squished) then the observed frequency is increased and at a high pitch. when the source is moving away (think about the waves being stretched) then the observed frequency is decreased and at a lower pitch.