When the player blows air through the mouthpiece, the air pressure inside the tube increases. This increase in pressure creates a wave of compression that travels down the tube. When the wave reaches the end of the tube, it reflects off the end and travels back up the tube. This creates a standing wave, which is a wave that appears to be standing still.
The standing wave causes the air inside the tube to vibrate at a specific frequency, which is determined by the length of the tube. The longer the tube, the lower the frequency and the pitch of the sound. The shorter the tube, the higher the frequency and the pitch of the sound.