Heat flows naturally from a higher to a lower temperature. Heat pumps, however, are able to force the heat flow in the other direction, using a relatively small amount of high quality drive energy (electricity, fuel, or high temperature waste heat). Thus heat pumps can transfer heat from natural heat sources in the surroundings, such as the air, ground or water, or even man-made heat sources such as industrial or domestic waste, to a building or an industrial application.
Heat pumps can also be used for cooling. Heat is then transferred in the opposite direction, from the application that is cooled, to surroundings at a higher temperature. Sometimes the excess heat from cooling is used for to meet a simultaneous heat demand.
Simply put, during a call for cooling, a heat pump will remove heat and humidity from your home and will transfer this heat to the outdoor air.
During the heating cycle, a heat pump will remove heat and humidity from the outdoor air and will transfer this heat to your home. This is possible because even 0 degrees Fahrenheit outdoor air contains a great deal of heat. Remember that your heat pump doesn't generate much heat it merely transfers it from one place to another.