
Could this be "The Eden Cycle" by Raymond Z. Gallun?
Reviews are scarce. Here are some excerpts, beginning with the overall concept:
[The story deals with] the social ramifications of a future world
where everyone, “blessed” with immortality, can “live” in any virtual
reality of their choice, shift from simulation to simulation at will,
and spontaneously conjure new ones.
There are similarities to the plot you recall; there are differences as well. For instance, here it's the girl who first realizes/discovers the truth. One reviewer has this to say:
The story starts off in what appears to be a small town right before
the Great Depression. Two kids. A boy and a girl. Growing up. Falling
in love... Then, the girl starts to think that nothing in their lives
is actually real. She starts having these dreams and impressions that
it's all just an illusion, and when she talks to the boy about it all,
he starts to agree with her, and together, they will themselves out of
their reality, instantaneously to a beach in a virtual but
real-seeming Hawaii.
This introduction reveals the character names and their location:
The plot follows Joey Martin and his love interest Jennie Murray as
they slowly come to realize that the world they live in, small town
Purdyville, is actually a simulation.
They uncover more details about the world(s) they live in:
Before long, they learn that they've been alive for hundreds or maybe
thousands of years, living countless virtual lives within a huge
virtual system the instructions of which were radioed to the earth by
an alien civilization.
How the system operates:
Now, almost every human has had his and her identities transferred
into tiny, shimmering balls, and within those balls, people have the
power to do anything, go anywhere, do whatever they want, in the
virtual past, the virtual future, with superpowers, immortality, et
cetera, with it all seeming perfectly real.
This segment delves further into these simulated lives:
If you get tired of a virtual reality, one can simply transfer to
another. If you want to find another “real” individual (or meet up
with one you met earlier) then simply wish to find them — if they want
to find you, then the wish will be fulfilled. If you want to violate
all laws, fly through space... If you want to have your memories wiped
and relive any life, then simply wish that at a certain point the
memories will be returned. Or, in the most drastic manner, simply wish
away your memories all together. If you die in a simulation then
you’ll simply be transfered to another.
~ Edited from Science Fiction and Other Suspect Ruminations and The Skeptics Guide to the Universe.
Another plot point which differs from the storyline you've posted. Once you've gone through the full reviews, you'll understand that the AI (Eden Machine) in the book hasn't actually subjugated humanity. Humans are willing participants.