The difference between road and rail signal color usage comes from the history of railways and the primacy of safety.
The old mechanical railway signalling arms were designed so that failure, which would be in the “down” position, meant stop.
The illuminated part of the signal consisted of two colored glass panels in the far end of the signal arm, beyond the pivot, which moved in front of a fixed lantern. Even though the higher of the two glass panels was the red panel, it showed when the signal was down and this meant stop.
While railways retained mixed mechanical and electrical signalling the signals had to be compatible.
Therefore, the new electrical signals showed red at the bottom so that train drivers always equated either signal in its down or bottom position with the order to stop.
Road signals had no mechanical forerunner and are designed so the most important light, the red, can be seen from the greatest distance. This means putting it as high as possible. Anyone who has used Junction 3 of the northbound M25 at night will appreciate this.
Additionally, visibility for railway signals is not the same issue as it is on the roads. Railway signal sites are carefully selected.
The historical explanation for the order of railway signal lights is only partly correct. Indeed, the country where lower quadrant semaphore signals, in which horizontal means danger and 45° down means clear, were used. In these signals the red light was therefore at the top.
The main reason for the red light being at the bottom in modern British signalling installations is the weather.
To ensure visibility in bright sunshine, each color light has a long cowl or hood above it. In the winter, however, snow can build up on these cowls and obscure the light above. Being at the bottom, the most safety-critical red light has no other light below it and therefore no cowl, so snow cannot build up to cover a red light.
There are two kinds of mechanical, or semaphore, signals.
In the older lower quadrant type, the arm slopes downwards from the pivot to show clear or green, is returned to the horizontal by a counterweight, and the lamp glasses are red above green. In the newer upper quadrant type, the arm slopes up for clear, returns by its own weight, as in the scene in the classic film The Lady Killers, and the lamp glasses are in fact side-by-side.
Red is nearer the pivot and green is to its right on the outside.
In both, the horizontal arm means stop but this is not synonymous with down, which means opposite things in the two cases. Red arms are always used in stop signals but distants, meaning warning, operate similarly. However, on distants the arm and lamp glass are yellow, not red, and these mean ‘pass with caution’.
The arrangement of multiple-aspect, colored light signals has nothing to do with that of arm position. The red is at the bottom simply because it is the position nearest the driver’s eyes; yellow is above, then green and, in four-aspect signals, the second yellow is topmost, above the green.
Road users do not have to pass a color vision test, and therefore the position of the red, amber and green lights must always be the same, so the light illuminated can be recognized by position as well as color. Such signals are usually placed at sites where a speed limit applies and, because of the higher braking coefficient of rubber tires, the driver can still stop safely even after identifying a red indication only by its position.
The train driver, whose color vision is checked regularly, has to act on signals at a far greater distance to ensure the train can be stopped in time. On main lines the indication has to be identified accurately at long range, when it is impossible for the driver to see its position and where he must rely solely on its color.
The original question was, in fact, incorrect, because there is no universal railway layout of green over yellow over red, in railway parlance, the caution indication is referred to as yellow, not amber.
In the past, some signals only had a single lens, the different indications being given by interposing colored filters over the beam.
The only fixed rule with the layout of signals with multiple lenses is that the one which exhibits the red indication is mounted nearest to the line of the driver’s eyes. In some places, therefore, it may be at the top, as it is with a road traffic signal.
On high-speed lines, it is necessary to have a double-yellow indication, which is exhibited by the signal before the one showing a single yellow for caution. That, in turn, will be a further three-quarters of a mile or so before the one showing red for stop. This gives a run of two signals warning of a stop signal ahead.
Such double-yellow signals normally have the two yellow lights separated by the green one, to maximise their visual separation when viewed from a distance.