I remember reading this when younger and I think it was in a collection of stories published in the 70's? A boy growing up attends school. He is very curious about his city and surroundings. No one ever leaves the city, despite there being tubes that at one time had trains for transport between towns. At one point, he meets an old man who has robot helpers and he talks the man into assigning one of the robots to him. That robot then follows his commands. As he tries to learn more from the robot, it freezes, so he takes it to the city master computer to fix. The city cannot repair it, so it clones the robot to remove the block. The replacement robot guides him to a spaceship which is buried under the sand outside of the city. He uses that spaceship to learn more and to travel. He confronts the city masters about all the info they have been hiding. He uses the tubeways to travel to other cities. He instructs the robot to take him away if they are confronted with enemies, which it does.