EDIT
A simple example of how “'magnetic fields do no work” is not always true.
Imagine 2 particles with *opposite” charges connected by a rigid rod. The charges are moving away from you (‘into the screen’).
[+Q]---[-Q]
A magnetic field acts to the right →.
The force on +Q is downwards. The force on -Q is upwards. This makes the system start to spin, so rotational kinetic energy is gained (work is done by the magnetic field).
This happens because the particles (charges) are connected.
END EDIT
________________
The electrons in an atom can be thought of as spinning charges, orbiting around a nucleus. (Though this isn't really accurate in quantum mechanical terms, but it will do.)
Each 'spinning' electron produces a small magnetic field. The orbital motion also produces a magnetic field, but spin’s field is the main one.
In iron (and a few other elements), the spins of some electrons in neighbouring atoms can get aligned in the same direction. We then get an overall magnetic field equal to sum of the fields from the aligned electrons.
So the ‘motion’ you are looking for is the ‘spin’ of the electrons.
___________________
How magnets do work is a much harder question. This gets this regularly discussed at length and it causes many arguments. E.g. https://www.physicsforums.com/threads/work-done-by-magnetic-field.31239/
My opinion is:
The statement that 'magnetic fields do no work' *only* applies to classical, freely moving point charges. This means quantum mechanical effects, such as what ‘force’ holds an electron in place in an atom, can’t be taken into account.
There are many situation where 2 magnetic field can interact and do work, e.g. 2 bar magnets being attracted). That situation is not comparable in any way to a freely moving point charge in a magnetic field.
Just my opinion though.