Here's why:
* Gas molecules have a lot of energy and move freely.
* Liquid molecules are closer together and have less energy.
* For a gas to become a liquid, the molecules need to slow down and lose energy. This energy is released as heat into the surroundings.
Think of it like this: When you boil water, you're adding heat energy to turn liquid water into gaseous steam. When the steam cools down and turns back into liquid water (condenses), that heat energy is released back into the environment.