Did you know that the invention of the transformer was accidental?

The first transformer was invented in 1831 by Michael Faraday, while he was carrying out some experiments concerning a physical effect he discovered. The English physicist and chemist had realized that a change in the intensity of a magnetic field associated with an object or with an electric charge can generate an electric current in a circuit located nearby. To better understand this phenomenon, Faraday exploited the discovery of Hans Christian Oersted, a German physicist, namely that electric currents generate a magnetic field.

Faraday therefore wound two coils of wire around an iron ring, which served as a magnetic core, so that there were no points of contact between the two coils.
When the physicist connected the end of one of the two windings to a pile, the current circulating in the circuit produced a magnetic field which circulated along the iron ring. This magnetic field, in turn, interacted with the adjacent winding, inducing an electric current in the second circuit.

When he connected the ends of the second winding to an electric current meter, he discovered that no current flowed in the second winding when the battery was connected, but only when the contact was opening and closing, i.e. when there was a variation of the magnetic field.

It was the first transformer, which he used to demonstrate the phenomenon of electromagnetic induction, i.e. Faraday's law of induction: a variable magnetic field passing through a circuit induces an electric current in it. Incidentally, Faraday had thus invented the transformer, but did not understand the practical importance of his discovery. Fortunately, the English scientist continued his basic research which led him to make other very important discoveries, while it was necessary to wait until 1882 for the Frenchman Lucien Gaulard and the Englishman John Gibbs to patent the first transformer for practical use.