A heatpump is a device that moves heat from one place to other.
It subtracts heat in one side (cools that side) and dumps it in the other (heats that other side).
We have already those devices available to install at home, and are commonly known as Air Conditioning.
The inside unit grabs the heat (cools the room) and the outside unit dumps the heat.
Those same devices are now reversible, so they are able to grab heat from the outside unit, and dump it in the room (heats the room).