The bastard is being given the standard hero treatment at the beginning, but then undergoes a Face-Heel Turn.
The hero doesn't know who his father is. He believes his mother was never married. Then he finds out she was.
... But it turns out he only did that to infiltrate the enemies' base and get a shot at the Big Bad.
The hero doesn't know who his father is. He believes his mother was never married. Then he finds out she was. Then it turns out his mother's husband was not his father.
Parodied: Princes father as many illegitimate children as possible, realizing their legitimate ones will grow up to be too spoiled to rule well and only the bastards are likely to go out and defeat evil.
Zig Zagged: The hero thought he was a bastard. Then it turned out his parents were actually married. But it wasn't a real marriage, since one of them was married to somebody else at the time. Later we find out his real parents were different people altogether, but he still grew up being treated like crap because of his supposed bastardy.
The hero's parents were married.
The hero was adopted.
Enforced: "The hero should be illegitimate so we can show how modern and tolerant we are!"
Lampshaded: "Farmboy, magic sword, prophesied Chosen One? Don't tell me, your father was a prince and he never married your mother."
Invoked: The king realizes evil forces are gathering, so he gets some mistresses in hopes of siring a hero.
Defied: The villain tries to assassinate the king's bastard before the crown prince, realizing that the former is more likely to be the Chosen One.
Discussed: "Don't you know how these things work? The king's bastard gets to go on quests, save the world and ultimately win the throne!"
Conversed: "The heroes in these fantasy novels always turn out to be the illegitimate sons of kings."
Deconstructed: The story examines the disadvantaged position of bastards in medieval society and the psychological repercussions of fatherlessness and discrimination.
Reconstructed: The hero's lack of identity and security shapes his character and leads to his questing, restless spirit, because he wants to know who he is and what he can do.