From a physics point of view it's like this.... Heat and temperature are not the same thing. Heat is the kinetic energy of atoms as they vibrate and bounce-off each other. Temperature is the frequency at which the atoms hit each other. Heat energy goes from areas of high temperature to ares of lower temperature. If you compress a gas you will raise the temperature but you will not add heat energy (the atoms are still moving at the same speed but impact more often due to the closer proximity). Thus, a heat pump works by compressing a gas (i.e. the "refigerant") in the hotter area. The temperature of the gas increases dramatically and heat energy dissipated to the hot (but not as hot as the gas) area. Once the gas cools it is moved to the colder are and allowed to expand. This results in the gas getting colder (colder than the cool area) which causes it to soak-up heat from the cold area. The refrigerant is pumped to the hot area and the loop continues.
Imagine a spong soaking-up the heat then the heat being squeezed-out someplace else.