What is it about trains? Well, you have a confined setting, but it's a setting on wheels, and therefore, the setting moves. So you get the best of both worlds: you can lock your characters in one place and watch them interact, or you can have the train stop and have some other stuff happen. Trains increase the intrigue by virtue of the fact that once on, you can't get off until it stops. Trains lend themselves to tension in so many ways.
Trains are also a concept which can be modified to fit nearly any time frame. Trains figure in a lot of far-future stories, as far from their 'wild west' forebears as you can get...and yet, there they are, strings of metal cars, riding atop rails or suspended from cables or embedded in tubes. Arnold Schwarzenegger's Quade boards a train once he gets to Mars in Total Recall. In the Commonwealth of Peter Hamilton's space opera novels, one travels from one world to the next not via starship but via train, as it's the trains that pass through the wormholes to other worlds.
Trains can be futuristic, but they don't have to be. The most famous fictional train right now may well be the Hogwarts Express, which departs from Platform Nine and Three Quarters in London for the great school of wizardry. The Express isn't one of the major locations in the Potterverse, but it appears in each tale, its importance quietly understated.
Of course, trains figure all the time in "real world" fiction. There's the Agatha Christie novel Murder on the Orient Express (whose solution is one of the more elegant to be found in Christie), and the same train figures prominently in the James Bond book and film From Russia With Love. You can't have Westerns without trains, and one of the most riveting action films of recent years, , dealt with a runaway train.
I wouldn't want to live in a world without trains, and I deeply wish I lived in a country that took them more seriously than others.