It is due to the potential difference between heterogeneous metals caused by the Seebeck effect. When two joints of two metals are at different temperatures, a potential difference will be formed between the two joints, that is, Seebeck electropotential.
Fundamental of Material Science -> Physical and chemical basis of materials