A man living in an underground city gets on his local subway train and keeps traveling, station after station, just to see where it goes.
Nobody has ever done this before. The staff on the train (who only each work a small section of train line) are interested in his journey, and allow him to continue. The train passes through thousands of miles of continuous underground city, past contaminated and bricked-up areas, past thousands of stations, and finally after many months or perhaps years, comes back to where he started.
He realizes the world or universe is all city, entirely urbanized and occupied by people, all the way to the core, and can estimate its diameter.
He also becomes concerned that the city-world may be slowly choking on its own toxic wastes... more and more areas are being walled-up and sealed off, and the whole civilization may eventually die.
As far as I can remember there is no mention of "sky" or even of a "surface" to a planet. Even the idea of "outside" is absent, if I remember correctly. It's not clear if it is set in a large converted planet, or if the entire universe is city.
It was written in English. I read it in the 1980s, and it felt like it could have been written any time from the 1930s to about 1970s.
It was almost certainly part of an anthology.