Towards the end of the 19th century a number of important inventions that changed human's perception of both time and space had been firmly established, with cinema being the last of them (or maybe radio). Railways were one such invention, or rather the combination of several inventions developed over a longer time. The steam locomotive came upon in the very beginning of the 19th century, but the first public railway opened in Britain in 1825 and in 1869 the First Transcontinental Railroad opened in the US. The train made it possible to travel fast and cover long distances, which made the world smaller and more manageable. Trains also meant that time needed to be standardised as it would not be possible to have a comprehensible time schedule if every other town and village had their own time. (Standardised time was even called railway time.) The electrical telegraph, the system of transmitting messages on wires over vast distances very quickly, developed more or less simultaneously, and the telegraph lines often went up along the railway networks. The telephone, which made it possible to even speak in person to somebody far away, made its first appearance in the 1870.*
So trains and cinema are connected. Just consider how several key films in the development of cinema are train-related, such as L'arrivée d'un train en gare de La Ciotat (1896), The Great Train Robbery (Edwin S. Porter 1903) or The Lonedale Operator (D.W. Griffith 1911). The last two of them also combined trains and the telegraph, neatly summing up the modern world.
A common theme in films about American 19th century history is the disruptive effects trains had, both positive and negative. In Matrix (The Wachowskis 1999) there is a scene where agent Smith is trying to kill Neo by pushing him in front of an oncoming train. When the approaching train is heard Smith says "That is the sound of inevitability. It is the sound of your death." and that is how many felt when the railway was being built across farmlands and such. While the railroad is often seen as a positive thing, bringing progress and prosperity, other times it is seen as a bad thing, bringing death and corruption. Last year's The Lone Ranger (Gore Verbinski 2013) is a current example of this. John Ford's breakthrough The Iron Horse (1924) is an early example where the railroad is seen in a positive light. Duel in the Sun (King Vidor 1946) shows both sides of the conflict, with the father and one son being against the railroad and the other son in favour of it. The pro-train son is the one who ultimately prevails. But there are hundreds of films around this theme. (What is less often acknowledged is that the railways across the US were to a large extent built by poorly paid Chinese workers.) Fewer films have been made about building the telegraph network, but there is at least Fritz Lang's Western Union (1941). It suggests that the telegraph caused disruptions too.
Trains are not only important in American films of course; it is a universal theme, albeit perhaps less connected to a national mythology in other countries. But in Satyajit Ray's first film Pather Panchali (1955) there is a sequence when young Apu and his sister, living in poverty in a small village, runs across the countryside to catch a glimpse of a train. The train here, too, as a symbol of progress and change.
Many filmmakers have showed themselves being drawn to trains, and it is a very cinematic thing. They are not only symbolic but also alive and moving, Unstoppable, at least according to the title of Tony Scott's last film (2010). An especially forceful depiction of a train is to be found in Runaway Train (1985), directed by Andrei Konchalovsky and based on a script originally written by Akira Kurosawa. Yet they are also recurring images in the much more still and quiet films of Yasujiro Ozu. But the one filmmaker for whom trains is especially important is of course David Lean. It is not only Brief Encounter (1945) and The Bridge of the River Kwai (1957) that are based around trains, they are an essential part of Lean's films, almost all of them. Summer Madness (1955, aka Summertime), Lawrence of Arabia (1962), Doctor Zhivago (1965), A Passage to India (1984), even a film which is primarily set on a ship, In Which We Serve (1942), has important scenes set on a train. Cinema and trains become one in his films: the greatest of filmmakers is also a great train lover. It was perhaps inevitable.
*Less relevant but still important was the development of mail order services, which really took off in the 1860s when Pryce Pryce-Jones in Wales began sending catalogues of his goods to the whole of Britain so that anybody could order from his shop and he would send it to them. (20 years later Sears in the US became the Amazon of its age the same way.)
John Frankenheimer's The Train (1964) is one of his best film and consequently one of the best films of the 1960s.
Here are links to the other contributors in the train challenge. They are all in Swedish with one exception - the first link. The Velvet Café, Rörliga bilder och tryckta ord, Except fear, Moving Landscapes, Jojjenito, Fripps filmrevyer, Movies-Noir, Fiffis filmtajm, Filmitch, Har du inte sett den.
Buster Keaton's The General (1926)