This is a simple brushed DC motor. A wire that carries current inside a magnetic field feels a push. The two sides of a loop are pushed in opposite directions, so the loop twists.
A split ring called a commutator swaps the current every half turn, so the push keeps going the same way. More turns of wire or a bigger voltage means a bigger push.
Real motors have many coils and spin thousands of times a minute. Here the spin is shown slowed 40 times so you can follow it, and the rpm number is the real one. Drag the motor to look from any side.