When a liquid (in my case I used butane) under high pressure is released into the air, it becomes gaseous, and the container seems to get colder. Why is it that turning a liquid to a gas requires energy when it was simply pressure that was keeping it a liquid? Where does it get this energy? Would the gas formed be colder, or no?
This is probably a bit of a simplistic explanation.
Due to the butane being released from the from the container, the pressure in the container decreases, which in turn, decreases the temperature of the container according to the Pressure-Temperature Law (also known as the Admonton Law), that states for an ideal gas:
$$P \propto T$$
The boiling point of butane is normally −1 °C at normal pressures – so in typical use at room temperature, it should have already vapourised. But, due to it being under pressure, it remains a liquid, undergoing evaporation in the container. So, butane has a vapour pressure that increases with temperature, as seen below:
Image source: Wikipedia, who sourced it from the CRC Handbook of Chemistry and Physics 44th ed
Even though butane (like all gases) is not an ideal gas, we can still surmise that if you drop the pressure (by releasing the gas), then the temperature of the gas also drops, especially considering the combined pressure due to that from the container and vapour pressure is rapidly released = rapid depressurisation = rapid loss of temperature, which is felt on the outside of the container.