The best way to explain how a heat pump works is think how a fridge works. All the components of a heat pump are almost the same as a refrigerator, as they carry out the same functions. The main difference is a heat pump works in reverse to a fridge.
An air source heat pump works much like a fridge operating in reverse to heat your home. Outside air is blown over a network of tubes filled with a refrigerant. This warms up the refrigerant, and it turns from a liquid into a gas.
This gas then passes through a compressor, which increases the pressure. Compression also adds more heat- similar to how the air hose warms up when you top up the pressure in your cars tyres. These compressed, hot gasses now pass into a heat exchanger, surrounded by cool air or water. The refrigerant transfers its heat to this cool air or water, making it warm. And this is circulated around your home to provide heating. Meanwhile the refrigerant condenses back into a cool liquid and starts the cycle all over again.