Pressure is proportional to temperature. The hot gas is cycled to the condenser. The condenser is a collection of heat-exchanging tubes at the back of the refrigerator. The hot condenser gives off heat to the warm kitchen. The gas turns to liquid as it loses its heat to the kitchen.
Heat moves from warm areas to cool areas.
In other words, the heat jumps from the hot tubes at the back of the refrigerator to the warm kitchen air. The refrigerant cools, condenses and turns into a liquid. The process repeats again when the refrigerant is cycled to the expansion valve and evaporator.