A heat pump captures heat from outdoor air, uses electricity to make that heat hotter, and transfers that heat into your home. It uses the renewable thermal energy in outdoor air (originally from the sun!) to heat your home. The idea of using the low temperature heat in outdoor air to make high temperature heat in your house sounds kind of magic, and it is, but it's also very common. Fridges and air-conditioners use exactly the same technology to move heat from a cold place (inside the fridge or the cooled building) to a hot place (outside the fridge or the outdoor air on a hot day).
The technology that performs this magic is called a refrigeration cycle. Refrigerant in the heat pump is first expanded to a really low pressure. The process of expansion makes it very cold. That very cold refrigerant then runs through a heat exchanger while outdoor air is blown passed the heat exchanger. Because the refrigerant is colder than the outdoor air, heat is transferred from the outdoor air to the refrigerant. We have now successfully captured the renewable heat! The next step is for the compressor to compress that refrigerant to a much higher pressure. This is the part of the cycle that uses electricity. The process of compression makes the refrigerant very hot. The hot refrigerant then runs past another heat exchanger where it transfers that heat to the water circulating around your home. If you home needs heating then that water circulates around your radiators. If instead you need hot water then it goes to yet another heat exchanger in your hot water tank and transfers the heat into your hot water tank.