A compressor puts energy into some gas by compression. The gas enters the inside of the fridge where it expands, absorbing heat. After it absorbs/expands, it reenters the compressor and it is compressed, releasing the heat that it has absorbed and its temperature rises as a result. Then it goes into that huge bunch of tubes in the back of the fridge to cool back down before reentering the inside of the fridge.