Once upon a time, the king of Thebes was told by an oracle that his son will kill him. Thus his wife deserts the child, leaving it to die. The child is then saved and raised by the king of Corinth.
This child was Oedipus. Once Oedipus grew up, he was told by an oracle that he will kill his father and sire children with his mother. To avoid his fate, he ran away from home. He ended up going to Thebes and meeting his father, the king, who he ends up killing in a fight.
What happened next was as foretold. He ended up accidentally marrying his mother. After he found out, he gouged out his own eyeballs and killed himself.
Then came Sigmund Freud who decided to name the idea that all children are sexually attracted towards their opposite sex parent, (at one point during their development period) after him.