The stator consists of either a permanent magnet or electromagnetic windings, and generates a stationary magnetic field around the rotor which occupies the central part of the motor.
The rotor is made up of one or more electric windings around armature arms. These electric windings generate a magnetic field when energized by the external current. The magnetic poles thus generated by this rotor field are attracted to the opposite poles generated by the stator field and repelled by the similar poles, which causes the rotor to rotate.
The DC motor doesn’t use an external current switching device, instead it uses a mechanical connector called the commutator which is a segmented sleeve usually made of copper, mounted on the rotating shaft. The current +/- is supplied to this commutator segments with the help of brushes.
As the motor turns the brushes slide over the commutator segments hence creating the variable magnetic field in different arms through the commutator segments attached to the windings. Hence a dynamic magnetic field is generated in the motor when a voltage is applied across the brushes.