In the time of the scientist Michael Faraday around 1820, since the only source of electrical energy available was that of a direct current battery, the current was changed through a system called a switch, which is still used today in toys and other small engines. https://www.mrosupply.com/v-belts/v-belts/4l-section/182998_84002540_gates-rubber/ This is the principle of electric motor operation. For the motion to occur, there must be interaction between the magnetic fields of a stator (fixed part of the system) and a rotor (moving part).
Studies of movement through electric power and positive results in practice have made Faraday a forerunner in this subject. Many other scientists have begun to speculate about the phenomenon of electricity after Faraday. When we put a coil between two fixed magnets without touching them, it points its north pole to the south pole of the magnet and vice versa. But as the coil poles are solved by the direction of the current passing through the wire, when we invert it, the poles are also reversed, which causes the coil to move again. If this reversal of the current is constant, it does not stop spinning.