|Thomas Johann Seebeck, Hans Christian Ørsted electromagnetism
Thomas Johann Seebeck discovered in an electric circuit with a junction of two metals that heating or cooling one side of the junction resulted in an electric current that deflected the arrow of a compass. Seebeck thought he had discovered a thermomagnetic effect, but Hans Christian Ørsted observed that the magnetic deflection was a result of the generated current, and coined the term thermoelectricity.
Thermocouple and thermopile
Put a temperature difference across it— you generate a voltage to measure the temperature, which is called a thermocouple, or to generate electricity, which is called a thermopile.
Not by accident
It couldn’t have been an accident, a circuit tossed together from parts remaining from other experiments. I have friends who have said nothing is accidental. Unknowable past lives explain this one. Sometimes things click when everything makes sense and explanations fall into place.