The principle is very similar to the operation of a refrigerator, but only in reverse. The heat pump system contains a fan that forces air through an evaporator

(1). The evaporator contains very cold liquid refrigerant. The heat in the air that passes through this evaporator is absorbed by the refrigerant. The now warm gaseous refrigerant is then circulated in the system via a compressor.
(2). As it goes through the compressor its pressure rises and the temperature increases further. From here it travels to the condense.
(3), where the heat from what is now a super hot refrigerant is transferred to the water supply tank. The cooled down refrigerant then goes through an expansion valve.
(4), which reduces its pressure cooling it further and the cycle starts again.