How about a little background information first? If you have 2 magnets, like charges would repel each other and opposite charges would attract each other. That is; N & N, S & S would repels each other. N & S would attract each other. This is a natural phenomenon.
Further more, if you wrap an iron core with an insulated winding and apply current (voltage) to it, this iron core would become an electro-magnet.
Now, consider 2 magnets are placed in a housing. One piece of magnet is fixed in place and the other piece is pivoted in the center so that it is free to rotate. When the like charges come together, the pivoted piece cannot move backwards. It has no choice but to rotate.
Now, consider if there are 2 iron-cored coils, called the field winding, you have one fixed in place, called the stator, and you have the other one pivoted in the center, called the armature. When you applying current to them separately, these 2 fields are electrically magnetized, as explained in the background information. If the current for the fileds are 180 degree out of phase, ie, the + always meet the + and the - always meet the -. The + always tries to chase the - and the - always tries chase the +. This phenomenon create a rotating motion. This is called the rotating magnetic field.