In Greek mythology, Cassiopeia was the beautiful but vain queen of Ethiopia. Her boasts led Poseidon to threaten the whole country with a sea monster, who was to be appeased by the sacrifice of daughter Andromeda until Perseus saved her.
Poseidon punished Cassiopeia in any case. He tied her to a chair in the heavens, in such a position that she would spend half of each year upside down. So it is with the constellation named after her: it is sometimes upside down.