Air mainly consists of gases such as nitrogen and oxygen. It is present in our surroundings, lungs, mouth, nose, etc.
When we speak, air from our lungs passes through the vocal folds making them vibrate. These vibrations make the air in our mouth and nose to vibrate back and forth, producing sound. The speed of sound in air is about 340 meters per second.
Helium is lighter than nitrogen and oxygen. Being lighter, sound travels faster in helium as compared to air. Hence, when we inhale helium and try to speak, the sound produced travels faster, thus producing that funny voice.