An electric motor converts electrical energy into mechanical movement. The inverse task, which converts the movement from mechanics to electrical energy, is performed by a generator or dynamo. https://www.mrosupply.com/popular_products/about-u-joints/ In many cases the two devices are different only in their application and minor construction details. The fundamental principle that electromagnetic motors are based on is that there is a mechanical force on any wire when conducting electricity, while compressed inside a magnetic field. The force is described by the Lorentz force law and is perpendicular to both the wires and the magnetic field.
Most electric motors work by electromagnetism, but there are also engines based on other electromechanical phenomena, for example, electrostatic forces. In a rotary motor, there is a rotating element. The rotor rotates because of the wires and the magnetic field that are arranged so that a torque is developed around the rotor shaft. The rotating part inside is called a rotor, and the fixed part is called a stator. It contains electromagnets that are wrapped in a frame, often called armature, but correctly armor is the part of the motor through which the voltage input is supplied.