It uses a compressor to do this. Often, an electric motor drives the compressor. The compressor compresses the refrigerant, and this makes it change from a gas to a liquid. When the refrigerant changes from a gas to a liquid, it also gives up some of the heat that it has been carrying.