King Laios and Queen Jocasta had Oedipus and he was born to kill his father and marry his mother.
So King Laios had a shepherd take Oedipus on a lonely mountainside with his legs pinned together but the shepherd took pity and gave him to childless Queen and King of Corinth
When Oedipus got older he figured out the prophecy and ran away, and while he was wondering the road an arrogant tried to run him off the road with his chariot so they fought to the death and Oedipus killed the man.
Oedipus encounters the Sphinx and has to get the riddle that went like this "what creature goes on four legs in the morning, two legs in the afternoon, and 3 legs in the evening"? And if he got it right then he can go in the city if not he would be eaten
Oedipus immediately guessed the answer was "man" the Sphinx let him by and he entered the city not knowing that he was born there.
The Thebes welcomed him as their savior and offered him the throne and the widowed queen since Laios had died.