It basically works out this way because collisions between gas molecules will tend to equalize the average kinetic energy of gas particles in the system.
Consider for example, a system that consists of a large number of identical gas molecules, half of whom are moving very slowly and half are moving very rapidly. Will this situation last? No, the fast gas molecule will eventually collide with the slow molecules, transfering kinetic energy from the fast molecules to the slow molecules until eventually, all molecules are moving on average at the same speed (sometimes collisions will slow the molecules down, and sometimes they'll be moving faster than the average because of collisions, but one molecules over time the average kinetic energy will be the same across the entire population).
Now consider a population of two gasses, one heavy and one light. What will the effect of these random collisions be? Will they all move at the same velocity? No, because when a heavy molecule collides with a light molecule, the larger molecule's momentum will transfer more kinetic energy to the light molecule than if a light molecule hits a heavy molecule. Thus, when things reach an equilibrium, the lighter molecules should be moving faster than the heavy molecules. If you do the math (probably the thing to look to for a formal proof is something called the equipartition theorem), you'll see that the situation where gas particles have equal kinetic energies is what results from the random collision of gas molecules.