The Heat Sinks function is to absorb and disperse the heat away from the computers processor.
Heat Sinks are also used wherever heat needs to be dispersed and absorbed in any other electronics as well to prevent damage.
The Fan is used on a heat sink to help keep the heat sink and the CPU at an appropriate temperature to prevent it from becoming too hot.