Like light, sound travels in waves. While light can travel through a vacuum, sound cannot. Sound energy moves through vibrations. The part of the instrument making the sound vibrates moving backwards and forwards pushing against the air.
This causes the air molecules to collide, thus transferring the sound energy from molecule to molecule away from its source, until it reaches our ears. Sound needs matter to travel. Space has no molecules for the sound waves to vibrate thus one does not hear sound in space.