Does this book exist?

Here is a vague plot description of what I think would be an entertaining read and hope that someone has read or knows of a book that fits the description:
Some guy (or girl) in their 20’s has always felt that they didn’t fit in to society. They never found anyone else like them, the way they think, their desires and so on. One day they stumble across something or someone that sets in motion of series of events that leads this person to discover who they really are and where they came from. It could be someone out of their intended period in time, or from a different galaxy/dimension or whatever.

Anyone hear bells ringing??

Theodore Sturgeon’s When You Care, When You Love is a similar concept, although not cosmic.

This trope is also typical of any number of mediocre adolescent wanker fantasy, what Norman Spinrad called the “Emperor of Everything” stories.

Well, the bells that I heard first are ringing for The Ugly Duckling by Hans Christian Andersen. But I am sure that I have seen this motif, more than once, in science fiction and fantasy.

I do specifically remember one short story. I can’t recall the author or title, but it was anthologized in Galactic Empires edited by Brian Aldiss. But there was a twist ending: the protagonist, who constantly fantasized about a world of knights and castles, was indeed from another world, but

was actually a serf.

That the story ended on that twist suggested to me that the author was spoofing either an earlier, well-known story with the more pedictable ending, or a motif common in the science-fiction genre.

Sounds like the A.E. Von Vogt 1940 classic Slan

Slan (1940) “This garish “unknown superman” tale, with its child hero and persecuted telepathic mutants made quite a splash in the pages of “Astounding” when first published. The astonishing plot reversals livened up an otherwise rather sentimental tale of wish fulfillment. Van Vogt’s most popular title in the U.S.A.”

Also sounds like it could be representative of the stories of “the People” by Zenna Henderson

“A central aspect of life for the People . . . is that they are Outsiders with a Home. The People look exactly like humans of Earth, but they do not completely fit into mainstream Earth culture. Even if they try, even if they try for generations, they can not be fully integrated. . . . But they’re not lost because they belong so completely to each other.”