It does just what it suggests, it pumps heat, taking energy from a (relatively) low temperature source and forces that heat to a higher temperature making it more useful. It is analogous to a water pump which raises water from low level to a higher level, a heat pump does the same – but with heat!
This diagram is purely illustrative of the effect of a heat pump and not its operation.
Even ice still has some heat energy, in fact energy is always present until the value of "absolute zero" is reached some –273.16°C, which is why the Kelvin scale has its start point at absolute zero (and hence freezing point is +273.16 Kelvin).
We should all be familiar with a heat pump since we most likely have one at home! A domestic refrigerator (or even freezer) is a heat pump – it pumps heat out of the device, thus cooling the inside.