Hans Christian Orsted was the scientist who gives the relation between electricity and magnetism. He found that the magnetic needle gets deflected on the application of electric current to the circuit.
He observed that the current carrying wire acted like a magnet.
In 1821 Michael Faraday understands Orsted's work and invented electric motor. An electric motor is a device which is used to convert electrical energy to mechanical energy.