He was sent by Poseidon (god of the seas) to kill Andromeda because her mother was arrogant and said she was more beautiful than the Nereids (daughters of Nereus, Nymphs of the seas) and even Aphrodite. Cetus was killed by Perseus who arrived in time to save Andromeda.
Perseus was able to kill Cetus with the head he had plucked from Medusa, who by designs of Athena had received a curse of having instead of hair serpents on her head, in which man who looked into her eyes would immediately turn to stones.
Where Medusa kept everyone she had transformed into her lair, which only allowed men to enter, to ensure that Medusa would not harm a woman. Perseus then, knowing where Medusa's lair was, went there and fought her, cutting off her head.
The beast sent by Poseidon was then destroyed with a single glance, turning to stone, and Perseus, to ensure that the beast would not return, shattered it with one swing of his sword, throwing it over a cliff. Thus returning to his family which he had lost long ago through Poseidon's fault.