Because of the free electrons that are present in the metals, it becomes a good electrical conductor. This is why this is one of the Properties of metals:

There are two effects that scientists have discovered:
Peltier effect
- When an electric current passes through a junction of 2 different metals, Heat is evolved at the upper junction and absorbed at the lower junction. One such product is a Peltier Cooler or heater / thermoelectric heat pump, which transfers heat from a side to another.
Thomson effect
- The other is an effect discovered by William Thomson, which describes a electric current is produced in the conductor with a temperature gradient which heats or cools. The reason for this was that the temperature difference between the 2 points will absorb or emit heat.