The head of ancient Egyptian sphinxes portrayed the reigning pharaoh but also, when featuring the head of a falcon, represented the sky-god Horus or Amun-Re, with the head of a goat. When the Greeks adopted the sphinx it became a female monster.
According to Greek legend the sphinx put a riddle to all who passed by and devoured those who failed to guess it. Getting it right meant the death of the monster a claim to the throne and the hand of Queen Jocasta. After many had died, one got it right: Oedipus.
The riddle that the sphinx put:
What animal walks on four legs in the morning, on two at noon, and on three at night?
Oedipus’s answer:
Man, for in the morning, the infancy of his life, he creeps on all fours; at noon, in his prime, he walks on two feet; and, when the darkness of old age comes over him, he uses a stick for better support as a third foot.
Oedipus, a mythical Greek king, was the son of Queen Jocasta and therefore had to marry his mother.