Here's a more detailed account of the story:
The Sphinx was a monstrous creature with the head of a woman, the body of a lion, and the wings of a bird. She would sit on a rock outside the city of Thebes and ask passersby a riddle. If they could not answer the riddle, she would devour them.
Many people had tried to answer the Sphinx's riddle, but all had failed. Finally, Oedipus came along. Oedipus was a young man who was known for his intelligence and wisdom. He listened to the Sphinx's riddle and immediately knew the answer.
The riddle was: "What is the creature that walks on four legs in the morning, two legs at noon, and three legs in the evening?"
Oedipus answered: "Man. As a baby, he crawls on all fours, as an adult he walks on two legs, and as an old man he uses a cane."
The Sphinx was so impressed with Oedipus' answer that she threw herself off the rock and died. Oedipus had saved the city of Thebes from the Sphinx, and he was hailed as a hero.