(the legal approach)
The big legal freeware list
Searching freeware (The illegal approach)
How do you set up -legally- a full-fledged windows computer without any money at all
(The legal path)
But, as usual, we don't have to rely on snotty commercial products. You can use BVE, serious if a tag primitive, with a huge amount of followers and contributors, that -alas- requires Microsoft's NET crap.
But you can use at once also the fantastic spoorsim, by Charl Vockerodt, with ONE diesel and ONE steam (South african) locomotives that will give joy to any kid of the world, for free. Free, duh, like in "free steamed rice". Alas this is true only for the slightly older version one that you can download from rapidshare right now (file name: SpoorSim_1_0.zip file size: 12704775 bytes): version two asks unfortunately for money.
Read the instructions and learn or print the command list BEFORE playing, there's no mouse support inside the program, like in Trainz (and there are many other limitations, yet SpoorSim it's great fun to play).
And, ah, yes, if you want to learn how to drive a steam locomotive... which is not all *that* easy, you may fetch Brian Hollingsworth's book (with the same title how to drive a steam locomotive... it's on the web, use your seekers' skills) or you can read this *wondrous* manual (play the number game on the URL :-)