A motor is a machine, which takes electrical energy and converts that electrical energy into mechanical energy.
DC motor works under the principle, that whenever a current carrying conductor placed in a magnetic field, a mechanical force will be acts upon that conductor and the conductor tends to rotate, if it is arranged freely to rotate.
The direction of the force or rotation can be determine by “Fleming’s left hand rule”