A heat pump acts as an air conditioner when it is warm in the space being conditioned. A heat pump does not generate heat. Instead, it uses a refrigerant to cool or heat air and then moves the conditioned air into or out of an area.
As part of an HVAC system, a heat pump is an air transfer unit. It has an air handler inside and a unit outside and moves the refrigerant between the two to create warmer or cooler air. It then takes that air and moves it into the area being conditioned by transferring air out of an area and replacing it with the conditioned air. To cool air, the heat pump reverses, pulling warm air out of an area, replacing it with cool air.