King Laius and Queen Jocasta of Thebes learned from an oracle that their newborn son, Oedipus, will kill his father and marry his mother.
The King and Queen ordered a Shepard to go into the forest and leave the newborn there to die but he didn't have the heart to do it, so he took it to another childless king and queen.
Once Oedipus was older and learned that his adoptive parents weren't his real parents, he ran away. Then on his way to Thebes, he ran into a man who he ends up fighting and Oedipus kills the unknown man.
On his way into Thebes, Oedipus is stopped by the sphinx, which tells him he has to answer a riddle to get in, he answers right, and the Sphinx goes away.
You have to answer a riddle first.
Thanking Oedipus for saving the city, the people offer him the throne and the queen as his bride. So he becomes king and have 4 children with Jocasta.
Many years past and Oedipus finds out who he really is, devastating himself and Jocasta. She kills herself and he gouges his eyeballs out to punish himself for such a sin. He gives up as king and walks the earth as a beggar.