A heat pump is a system that can both cool, heat, and dehumidify air in a room, depending on the demand. These systems have a reversible heat transfer cycle.
This means that if the air in a building needs to be cooled, then the evaporator that produces cold air is placed in the building, and the condenser that produces heat is placed outside.
If heat is required inside the building, the process is reversed. The evaporator in the building is used as a condenser (producing heat), with the condenser outside functioning as the evaporator. The process can be reversed whenever necessary.
A heat pump is a good alternative to an electric heating system.