A heat pump can extract energy from two main sources:
Solar energy is stored in the air and in the ground. The heat extracted from each heat source is transferred by the heat pump to the heating system using the refrigeration cycle.
The extracted heat is usually transferred into water for distribution in a so-called "wet" heating system using radiators or under floor heating. You will see heat pumps described as air/water or ground/water to indicate the source and the output of the system.
The air and the ground provide an effectively limitless source of energy at no cost which makes heat pumps such an interesting proposition.