The story line: a young boy raised in a farming community finds a door in a wall that he thought was the physical limit of his world. His community puts food on a conveyor belt that goes thorough the wall, to where they do not know, and do not question. The door leads him to another world, where he meets a young girl who joins him on adventure. In brief, the two discover there are four or five worlds/communities all in a huge hollowed-out asteroid...which they discover was sent from earth thousands of years before to start the colonisation of a new world..but no one in any of the separate worlds on the asteroid remembered this. They figure it out, and make the scientist/navigator/pilot world aware of it and thus save the asteroid 'world" of people.
Does anyone know the title and/or author of this story? It was spectacular for me at a very young age.
Edited to add:
As my memory further serves, there were 4 or 5 worlds within this hollowed-out asteroid. The boy's farming community sent food on a conveyor belt through a wall, and they received manufactured goods similarly. One of the worlds was a manufacturing world, and another was responsible for the piloting of the asteroid...but the knowledge that that was their task was long ago forgotten. I believe that eventually everyone learns, thanks to the boy and girl, that the asteroid is going to crash into a star if they don't take control and complete the original mission of colonizing a planet that orbits that star.
There is no religious persecution story, and no sex story, as one of the respondents had suggested in the book/story they recall.
I most definitely read it in the late 1950's, so it isn't Orphans of the Sky which I'm advised was written in the 70's, though it's entirely possible Heinlein borrowed the themes from someone else's earlier story.
I hope this additional information helps, as I am eager to learn the title of this book/story and the author.