A heat pump forces the refrigerant to change from a gas to a liquid. 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. Compressing will heat up the liquid extensively.