Combustion of the air-fuel mixture in the cylinders generates heat which produces high pressure, to force the piston down in the power stroke. Not all of this heat can be converted into useful work on the piston, and it must be removed to prevent seizure of moving parts. This is the role of the cooling system. Most engines are liquid-cooled.
A liquid-cooled system uses coolant - a fluid that contains special chemicals mixed with water. Coolant flows through passages in the engine, and through a radiator. The radiator accepts hot coolant from the engine, and lowers its temperature. Air flowing around, and through the radiator takes heat from the coolant. The lower-temperature coolant is returned to the engine through a pump.
Air cooling is common on smaller internal combustion engines. Some engines use cooling fins. Their design makes the exposed surface area as large as possible, which allows more heat energy to radiate away, and be carried off in convection currents in the air. Some engines also use a fan to direct air over the fins.