The hydra was a snake-like animal with many heads, and if any head was cut off two more grew back. Both its blood and its breath were poisonous. Hera had raised the hydra for one purpose: kill Heracles.
Again, there are two stories as to how the hydra was beaten. In the first Heracles tries to cut the heads off, but sees that two grow back, and so asks his nephew Iolaus to burn the neck stumps after he removes a head.
In the second he again sees how the heads grow back, but this time needs no help: after cutting the head he dipped his sword into the hydra’s poisonous blood, using that to poison each neck after he cuts a head off.
In both stories Hera tries to make the task even harder by sending a large crab to attack Heracles while he is fighting, but Heracles quickly crushes the crab under his foot.
After the fight Heracles dipped his arrows in the hydra’s blood, making them poisonous. Hera, meanwhile, placed both the hydra and the crab in the sky as constellations. This is why Cancer (the crab) comes after Leo (the lion), and the hydra is close by.