Scarabs were popular amulets in ancient Egypt starting in the early Middle Kingdom (2000 BC) and remaining popular for the duration of the pharaonic period and beyond. Egypt’s ancient neighbors imported scarabs as well as produced them in local styles.
To the ancient Egyptians, the dung beetle Scarabaeus sacer was a symbol of Khepri, the early morning manifestation of the sun god Ra, based on the beetle’s behavior of rolling a ball of dung across the ground and Khepri’s task of rolling the sun across the sky. When they observed young beetles emerging from the ball of dung, they mistakenly believed that the male beetle was able to reproduce simply by injecting his sperm into a ball of dung, drawing parallels with the creator-god Atum (1).
The ancient Egyptian word for beetle was kheper which was also the word for existence. Thus, if you wore a little carved beetle around your neck, you would continue to exist.
(1) Pat Remler (2010). “Scarab beetle”. Egyptian Mythology A to Z (3rd ed.). Infobase Publishing. pp. 169–171.