“A motor is a machine that converts electrical energy to mechanical energy.”
In another word, the electrical energy is a “battery” and the mechanical energy is the “rotation.”
1. When electric current flows through an electrical wire placed between two magnets facing each other, it generates force. Electric current, magnetic field, and motion respectively apply perpendicular directions to each other just as when you open the middle finger (electric current), the forefinger (magnetic field) and the thumb (force) of your left hand respectively to mutually orthogonal axes.
2. When the electric current flows through the electrical wire, it generates a magnetic field around. The magnetic field attracts or repels the magnetic field from magnets, which generate force to move the electric wire. The electrical energy here is “electric current,” and the mechanical energy is “force.”