[T]he amulet of the heart ... was directed to be made in the form of the scarab at a very early date. We can trace the ideas which the Egyptians held about this insect as far back as the time of the building of the Pyramids, and there is no doubt that they represented beliefs which even at that early period were very old.
The Egyptian seems to have reasoned thus: since the physical heart is taken from the body before mummification, and the body has need of another to act as the source of life and movement in its new life, another must be put in its place. But a stone heart, whether made of lapis-lazuli or carnelian, is only a stone heart after all ...
But the scarab or beetle itself possesses remarkable powers, and if a figure of the scarab be made, and the proper words of power be written upon it, not only protection of the dead physical heart, but also new life and existence will be given to him to whose body it is attached...
The unseen power of God, made manifest under the form of the god Khepera, caused the sun to roll across the sky, and the act of rolling gave to the scarab its name kheper, i.e., "he who rolls." The sun contained the germs of all life, and as the insect's ball contained the germs of the young scarabs it was identified also with the sun as a creature which produced life in a special way.
Now, the god Khepera also represented inert but living matter, which was about to begin a course of existence, and at a very early period he was considered to be a god of the resurrection; and since the scarab was identified with him that insect became at once the symbol of the god and the type of the resurrection.
But the dead human body, from one aspect, contained the germ of life, that is to say, the germ of the spiritual body, which was called into being by means of the prayers that were recited and the ceremonies that were performed on the day of the funeral; from this point of view the insect's egg ball and the dead body were identical.
From Egyptian Magick by E.A. Wallis Budge, ca 1901. Emphasis mine.