It has to do with the speed of sound.

Normally, your voice travels through regular air, which produces the sound that your voice usually makes.

When you replace the air in your lungs with helium, the distance your voice has to travel stays the same, but the material it has to travel through changes. Because sound travels through helium twice as fast as through regular air, your voice sounds higher.

Source: My new favorite show Brink.