Cancer the Crab is the constellation between Gemini and Leo, and it was known
since around 4000 BC. In these times, Egyptians and Babylonians saw the crab as a
turtle, and later the Egyptians went and saw the sacred Scarabaeus in it.
Nevertheless, a crab was seen in it as well, mainly because it seems to move forward
and then backwards again like a crab.
To the Egyptians, the sacred Scarabaeus was considered as a symbol of resurrection, which led directly to the crab's association to the Moon which also seems to die and being reborn in constant change. Further, the crab belonged to the waters, which seemed to move forward and backwards, too, when 'listening' to the Moon.
In another view, the scarab was the symbol for the scarab god Khepera rolling the moon across the sky like a dung beetle its ball of dung. The dung beetle does that to lay its eggs into the dung ball, where they would hatch and grow while eating up the ball. To the ancient Egypts it looked as if the little beetles where creating themselfes in the dung ball, therefore took it as a simile for self-generation and self-renewal, attributes for which the god Khepera became famous.
The glyph for scarab
Cancer in the Egyptian zodiac
Beside this, Khepera was often shown while rolling the sun across the sky, which
later led to his reputation of another sun good.
What as well turtles, scarabaei and crabs have in common is a soft inside and a hard shell to protect it. Crabs also have their claws with which they grasp something and hold it.
The Greeks saw the Crab as a creature sent by Hera to kill Hercules, whom she hated because he was yet another one of Zeus' illegitimate children and thus another prove for her husband's unfaithfulness. Hercules crushed it and Hera placed it in the sky to reward it for its devoted obedience.