Translation:I am taking the train from Hamburg to Vienna.
"with the train" is not very good English. If you want to use the verb "traveling" you can say "via the train" or "by the train" or "on the train" but it will sound awkward unless you rearrange the words. "I am traveling from Hamburg to Vienna on the train" is more natural. To keep the original word order you'd need a different verb.
The basic meanings are aus = from out of; von = from.
But why we say "Ich komme aus Hamburg" but "Ich fahre von Hamburg nach Berlin", I don't know -- why Hamburg is treated as having an inside (I come from inside Hamburg) in one case and without an inside (I go from Hamburg [as a whole] to Berlin) in the other case.
"Translate as literally as possible, as freely as necessary".
So basically try to keep the wording fairly close to the original, except when that results in something that's not normal English.
This is one of those "except" cases. (Others include formulaic phrases such as "mir geht's gut".)
Well, at first I understood this sentence like the train's driver is driving the train. But in here, the default translation for ''Fahren mit dem Zum'' as an expression means: ''I am taking the train.'' ...So, is it correct to say: Ich fahre mit dem Auto nach Spanien? in the same way?
In English, you travel "on" a train, bus, plane, etc., even if you have a roof over your head and are inside a closed space.
See meaning 3 at https://www.oxfordlearnersdictionaries.com/definition/english/on_1?q=on , for example.
Perhaps this comes from the days when vehicles did not usually have a roof and you climbed onto the top. We still say "get on" and "get off" as well, not "get in" and "get out".