Medusa, originally a beautiful young woman whose crowning glory was her magnificent long hair, was desired and courted by many suitors, but Medusa was a priestess of Athena and had taken a vow of chasity. Poseidon found her worshipping in the temple of Athena and had sex with her. Athena watched as they had sex. Therefore Athena was outraged at her sacred temple being violated, and punished Medusa by turning her beautiful hair into snakes and giving her the destructive power to turn anyone who looked directly at her into stone.
In both Greek and Roman mythology, Perseus, attempting to rescue his mother Danae from the coercive King Polydectes, needed to embark on the dangerous venture of retrieving Medusa's head. With the help of Athena and Hermes - magic winged sandals, a cap, a pouch and a mirror-like shield, he fought her and beheaded her by viewing her image in the mirror of his shield rather than looking at her directly. From her decapitated head sprang the winged horse Pegasus and the giant Chrysaor, who became king of Iberia. Medusa's sisters, the Gorgons, chased after him, but were unable to catch him because his magic cap made him invisible.
Perseus was then able to use Medusa's head as a weapon during other battles (which included rescuing Andromeda), but he eventually returned it to Athena, who then placed it at the center of her shield Aegis as a symbol of her power, and her own capacity to turn her enemies into stone.