Why do lighter atoms and molecules diffuse upwards?

It's a statistical walk, but its biased. Consider the energy in the system containing all of the molecules. One factor is the potential energy due to gravity for all molecules, and the other factor is the velocity of the particles which is in a random direction. Due to thermodynamics, we know that the system will proceed to the system which has the highest entropy, which in this case means preferring the configurations which have less potential energy.

The actual mechanic which biases this walk is that the path of the molecules is not straight. It is a more ballistic trajectory due to gravity. The effect of this gravitation term is tiny on the order of the free path lengths of the atoms (62nm for atmospheric pressure), but it's there. This means that a particle which would see equal collisions from all directions sees that the collisions from below are slightly lower velocity than the ones from above. This means the collisions from below will balance the conservation of momentum and conservation of energy differently because one is dependent on $v$, while the other is dependent on $v^2$. The heavier molecules will slowly proceed towards lower altitudes, while the lighter ones get bounced upwards by this series of uneven collisions at higher velocities than they are bounced downwards. Think of it like a stacked ball drop. If, in the collision, the heavier ball is on the bottom, the conservation of energy and momentum will send the small ball skyrocketing. If the smaller ball is on the bottom, the bigger ball doesn't go very far at all. This effect will be occurring in all directions in a gas, but because the collision velocities from above and below are different, the effect will have a tendency to send smaller molecules higher more often than it will send them lower.