It was sent by Poseidon as revenge against the Trojan king, Laomedon, for cheating the god out of payment for building the walls of Troy. As the creature ravaged the Trojan coast, Laomedon decided to offer his daughter, Hesione to the monster as a sacrifice in hopes of appeasing Poseidon.
Hercules, who was returning from the queendom of Amazons, agreed to kill the monster, on the condition that he be allowed to marry Hesione, and Laomedon would give him his divine horses as dowry (The horses had been given to Laomedon’s father Tros by Zeus as compensation for kidnapping Tros’ son Ganymede).
Hercules slew the monster by allowing himself to be swallowed, and stabbed it from inside. Laomedon promptly went back on his word and drove Hercules away. Years later, Hercules, alongside Telamon and Peleus, returned to exact revenge. Telamon knew the weakness in the Trojan walls and exploited it. Hercules sacked the town and slaughtered Laomedon and his sons, except for the youngest, Podarces. Hesione begged Hercules to spare her brother's life, and Hercules gave her in marriage to Telamon. Afterwards, Podarces was renamed Priam, and would go on to rule as the last king of Troy.
While speaking with Porphyrion, Jason Grace says he was the slayer of the sea monster of Troy. Also, Aeolus mentions that Jason has already been to his palace once when searching for information on a sea monster.