When a gas converts to a liquid, it forms new intermolecular interactions (weak bonds for lack of a more accurate description). Bond formation is an exothermic process, so heat is released from the molecules to the environment. This is why steam burns are so much worse than hot water burns even though the steam and hot water are at the same temparature.
It might be easier to see in the opposite direction. Conversion of a liquid into a gas requires that you add energy into the system to break the intermolecular bonds, so it is endothermic. This is how perspiration works to cool you off.