I want to give you an example to my question:
When you spray some pressured gas on a surface, liquid water for example, the surface could freeze. but why..
As far as I know molecules close to each other are on a high energy level, which explains the higher temperature under pressure ..it wants to expand because all molecules prefer a lower energy level.. so when expanding, the gas loses some of it's overall energy.. but wouldn't that also mean the surroundings would be heated instead of being cooled down since the lost energy of the gas would be transferred to it? Is it maybe because the gas takes energy to expand? But then, why does it want to expand if it takes energy to do so?
I know this is a little mess of thoughts and might seem simple to you, but I hope you can find an answer for a non-physicist.