Well, hydrogen and helium are the lightest elements. Their molecules move so fast they escape the planets gravity and escape off into space, this is also why, after earths first atmosphere formed, ( made of hydrogen and helium, ) it disappeared fast because of this, and got replaced.