Consider an metal rod heated at one end & cooled at the other end as shown.
The electrons in the hot region are more energetic and therefore have greater velocities than those in the cold region. Consequently there is a net diffusion of electrons from the hot end towards the cold end which leaves behind positive metal ions in the hot region and accumulated electrons in the cold region. This situation prevails until the electric field developed between the positive ions in the hot region and the excess electrons in the cold regions prevents further electron motion from the hot to cold end. A voltage developed between the hot and closed ends with the hot end at positive potential at the steady state.
This effect in which a temperature gradient between two points in a material (may be a conductor or semiconductor) gives rise to a built in electric field or a voltage difference between two points. This phenomenon is called the Seebeck effect or the thermoelectric effect.