The history is older than most people expect. Buddhism arrived in the third century BC, carried across by Mahinda, son of the emperor Ashoka, which is why so much of the island feels half familiar to an Indian traveller and half not. Anuradhapura was the capital for over a thousand years. Sigiriya, the rock fortress with the frescoes near the top, went up in the fifth century for a king who had murdered his father and did not expect to be forgiven.
Then came the coast. The Portuguese landed in 1505, the Dutch took over in the 1650s and rebuilt Galle into the fort you walk around today, and the British arrived in 1796, taking Kandy in 1815 — the last kingdom on the island to fall. Independence came in 1948, and Ceylon became Sri Lanka in 1972, though the tea still ships under the old name.
That tea is the reason the train exists. When blight destroyed the coffee plantations in the 1870s the planters replanted with tea, and a railway was pushed up into the hills to bring it back down. The line from Kandy to Ella was built to move cargo. The view was an accident.