A freezer and fridge work the same way by using a refrigerant to move heat from inside the unit to the outside. In combination units, air from the freezer is used to cool the refrigerator compartment.
In order to create the cold temperatures inside a freezer, a refrigerant is cycled repeatedly through a system where it changes state from gas to liquid and back again. To begin the cycle, a compressor pressurizes the refrigerant in its gaseous state. Compressing the gas causes the temperature to rise. It is then run through a condenser coil where the heat is transferred to the outside air, and the gas condenses to a liquid.
The liquid, which is still under high pressure, is sent through an expansion valve. The expansion valve lowers the pressure of the liquid, and it begins to change back into a gas and drop in temperature. The refrigerant is then routed through evaporator coils in the freezer. As it passes through the evaporator coils, the refrigerant continues to change into a gas absorbing the heat from air circulated through the coils by a fan. From the evaporator coils, the refrigerant, which is now a gas, returns to the condenser to start the cycle again.
A refrigerator without a freezer works in a similar fashion, while a refrigerator with a freezer uses cold air from the freezer to cool the refrigerator compartment.