The dynamo and the engine are reversible engines. The electric motor is machine that converts electrical energy into mechanical energy: in use it is exactly the opposite of the dynamo. However, by making minor changes to secondary devices, the DC electric motor is built in the same way as the dynamo. Machines that can be used as dynamo can also serve as motors, provided that an electric current is applied. An electric motor whose rotor rotates by mechanical energy, will produce electric power usable in external circuit.
When a magnet moves near an electric circuit, its electrical current is changed. This phenomenon called magnetic induction is explained by the Law of Lenz, https://www.mrosupply.com/bearings/mounted-bearings/bearing-inserts/487570_cb22436h_rexnord/ which says that the direction of the induced current is opposite to the variation of the magnetic field that generates it.
The dynamo is a generator that produces electrical energy by the displacement of conductor wires within the magnetic field. Your rotor rotates by virtue of shared motor power through a diesel engine or any other power source. The armature coils are arranged so as to cut at right angles the inductor induction lines, and it is this movement that generates electromotive force.