Molecules are always moving. Even at a (theoretical) temperature of absolute zero, there is still motion due to zero-point energy. One can watch liquid helium move up and out of a container, at 2 K!
On the average, molecules move at approximately the speed of sound (well, within a factor of two, or so). At room temperature and pressure, the molecules are scooting about randomly at roughly 500 m/s, bouncing off each other and the surface of any object. Eventually, they spread throughout a container, and out any opening, top or bottom, by the process of diffusion. Wait long enough, and they'll exit anywhere, and outside molecules can enter through that opening, until the inside and outside are in equilibrium.
However, the molecules do not leave, all at once, at 500 m/s, because they get in each other's way. If the hole is relatively small, as molecules try to leave, they are blocked by those already in the hole. If the gas inside a container is less dense (i.e., more buoyant) than that outside it, and the hole is on bottom, then external air pressure slows that diffusion, so, in a narrow-necked flask of hydrogen or helium, or just hot air, turned with the opening at bottom, it would take longer for the gas to diffuse out (and for the more dense gas outside to enter) than if the flask were upright.
The same would be true if one left dry ice in an upright flask -- it would take longer to diffuse out, to be replaced by air.