Old Twentieth by Joe Haldeman

My son John read this, enjoyed it and passed it along to me. I enjoyed it, too. The twist at the end surprised me.

Publisher’s summary:The passengers aboard the starship Ad Astra spend most of their time on the thousand-year journey to Beta Hydrii within the virtual reality of twentieth-century Earth. There, they can experience nostalgia for the hardship of a life they’ve since evolved beyond.

But when people inside the virtual reality chamber start to die, engineer Jacob Brewer finds himself face-to-face with a sentient machine obsessed with humanity. It has put itself in charge of the ship. And it wants to talk to Jacob…