Original AC motors can usually be run on DC too. But DC motors cannot run on AC. AC is changed to DC and/or its voltage is regulated on the trains boards. Done in various places unique to each board. But AC it is normally rectified by four diodes, or its larger epoxy/heat-sink equivalent of all four diodes placed in one package called a "bridge rectifier". Half rectification is possible, allowing ac and dc to both exist on the same circuit. A very simple oscilloscope read, (just "waves" on an easy graph)2, is the best way to see & understand the AC/DC together.
A diode is usually a "one way check valve".(but can switch/ boost/ modify) "Transistors" and "chips"(more "packaged combos") vary more, voltage regulation, a mini-relay thrown with power(on/off/+/-).etc, etc.
Transistors set up in combination series produce F-N-R-N.
Look close at a bridge rectifier schematic symbol. It may help some if you can think "it flows like water, and a diode is a one way check valve". Each AC leg's(2) alternating push is sent to the dc+, check valves set to produce a steady stream of DC+. Each ac leg needs to pull too, so the same set up on the "pull"(-) cycle gives the steady DC-.
Help any?