Sounds Strange, no it’s not but actually a diesel locomotive engine is a power plant which generates electricity.
So how diesel locomotives work?
Many think somehow a diesel engine is coupled directly to wheels via transmission (gear box, fluid couplings etc.) and that’s how a diesel would engine works but that design proved to be uneconomical and was not able to deliver much power. No diesel engine which was directly coupled with the wheels was made which can deliver power more than 1500 KW. That was old diesel-mechanical system
Modern diesel locomotive engines are rated more than 4000 KW and they are not directly coupled to wheel via transmission but in a modern diesel locomotive a 2 stroke or 4 stroke diesel engine is used to power an electric generator, this generator produces electricity which is then transmitted to traction motors (generally D.C. traction motors are used), the traction motors are coupled to wheels and that is how a diesel locomotive works, this system is called diesel-electric system
Mechanical energy to electrical energy and again electrical energy to mechanical energy