When you spray gas from a compressed spray, the gas gets very cold, even though, the compressed spray is in the room temperature.

I think, when it goes from high pressure to lower one, it gets cold, right? but what is the reason behind that literally?