Kim is full of opposites that actually complement each other: the lama and Kim; Kim's dual influences from India and formal English education; and even the Babu and Creighton. Kipling seems to be trying to say that these opposites in the book—like, say, England and India themselves—go together like peanut butter and jelly. The train and the Grand Trunk Road provide another example of this kind of equal-but-opposite imagery.
The Grand Trunk Road is an ancient highway from Kabul in Afghanistan, through the Punjab, and on east to the Ganges Plain; it's been in use as a track, even before it was officially paved, for over three thousand years.
On the Grand Trunk Road, Kim sees a real cross-section of Indian society: there is the old man who fought against the "Mutiny" in 1857 and his younger soldier son; there is the Kulu woman and her southern Orissa ("Oorya") and northern hill folk servants; and there is that Englishman who flirts with the Kulu woman and who also turns out in Chapter 12 to be yet another secret agent in the Great Game. As the Old Man Who Fought in '57 (that's what we like to call him) puts it:
All castes and kinds of men move here. Look! Brahmins and chumars, bankers and tinkers, barbers and bunnias, pilgrims and potters—all the world going and coming. It is to me as a river from which I am withdrawn like a log after a flood. (3.177)
Since castes tend to keep to themselves, it's a big deal to have a place that mixes people of many castes together, as the Old Man Who Fought in '57 says that the Grand Trunk Road does.
(By the way, we should mention: the caste system in India is a hierarchical social order, where individual families belong to one of four general groups. These main groups are the Brahmins (priests), the Kshatriyas (warriors), the Vaishyas (traders), and the Shudras (laborers). Within these large categories, there are literally thousands of subdivisions. Traditionally, castes could determine the kind of work you do and who you might marry.)
And then there's the train. Its origins are certainly very different from the ancient highway of the Grand Trunk Road. As the Sikh artisan (an artisan is a skilled craftsman) tells us when the lama first boards the crowded train car, "This thing is the work of the Government" (2.13). The train is so ultra-modern (well, for 1901) and fast that it almost frightens the lama away from using it. But like the Grand Trunk Road, it brings the people of India together despite their cultural differences.
When the lama and Kim first board that train out of Lahore in Chapter 2, they meet a bunch of people, many of whom have disagreements with one another. The wife of the farmer hates the Amritzar prostitute for being "most outrageously shameless" (2.25) while the Dogra soldier gets annoyed at the suggestion that there are Sikhs who fight alongside his people, because a Dogra is "of another caste than a Sikh" (2.38). But despite the personal and cultural differences among these people on the train car, they are all going to the same place on the same train.
The technology of the train provides an updated, modern version of the Grand Trunk Road, but both function equally to unite diverse groups in a common space. Every time Kim enters a train or walks the Grand Trunk Road, we see a cross section of the British Indian nation as Kipling wants to portray it: maybe there are small points of conflict, but everybody is really unified despite these differences.