Where do flying gas molecules get their energy from? If you heat up water in a tank to boiling point, some of the water will turn to steam. Gas bubbles are created in the water. According to Archimedes principle, the gas bubbles will have a force equal to the weight of what they are occupying. Let's denote this force $F_g$.
$$F_g = \text{Bouyant force of a gas bubble}.$$
Let's denote the height of the tank $h$. We also assume the steam bubbles are created at the bottom of the tank and also that the viscosity of water is nearly zero. So the work done when a bubble reaches the surface is
$$\text{Energy} = (F_g-g m)h$$
$g$ is the gravitational acceleration and $m$ the mass of the bubble.
Where did this energy come from? From the surrounding water? From the boiler? From the bubble itself?
Can someone in detail explain to me this phenomena? 
 A: Let us assume that once the bubble is created, the physics is essentially no different from what is responsible for the work making an Helium balloon rise in the air i.e. you have a macroscopic/mesoscopic object which has a density smaller than that of the fluid surrounding it.
Now, we all know that in a static fluid under gravity, pressure is decreasing with height. The reason for that is because any fluid follows an equation of state $p = f(n,T)$ where, at fixed temperature say $f$ is an increasing function of the particle density $n$.
Hence saying that the pressure decreases as we go higher in a fluid means that the density goes lower.
If the temperature is the same (buoyancy is observed on length scales much smaller than the scale over which temperature changes) then, it means that the big particle doesn't receive the same amount of collisions coming from the bottom than that coming from the top. As a consequence it will experience a net force in the upward direction.
As Pratyay Gosh has said, the energy of the system need not change here, the thing that changes however is the total entropy of the system that is related to the fact that closer to the bottom wall there are more particles that are "bothered" by the presence of the lighter bubble (because it's huge) than if you were to put this bubble at a higher position.
One way to realize that is to imagine the amount of work one needs to perform to insert a bubble somewhere at some height in the fluid. It is kind of intuitive to see that the less dense the fluid is, the more probable it is to find a "void" in which one can insert the bubble. That is what I mean when I say that is because of entropy.  
A: When a bubble is rising up, water is filling up the space behind it. The work done by the bubble rising up is exactly same as the water coming down to fill the space behind it, but with a -ve sign. So the total energy will remain constant.  
