Refrigerants are compressible. Heat is stored between the molecules of the refrigerant (1). The compressor motor compresses the refrigerant as it passes through the outside coils, pumping heat into the kitchen. The refrigerant passes through an expansion valve and then inside the fridge it expands, sucking in heat from the inside
An air conditioner is the same but bigger
A heat pump is the same but backwards
Peltier coolers are useless
(1) Not true at all but this is a great mnemonic from my old chemistry teacher