Khepera (also referred to as Khepri or Kheper) is one of the most ancient gods of Egypt. We know very little about him since his cult is very hard to seize in the Egyptian religion. We can meet him in texts and on wall-scenes but neither do we know about any of his temples, nor can we clarify his mythical role.
The two dimensions of his function are closely interrelated. On one hand he is the symbol of creation, the being of its own origin. The full version of his name (Khepera Kheper Djesef) means "The One Who Creates Himself" or "The One Who Originates from Himself" (the meaning of word 'kheper': happen, create, come into being, become). Mostly he is portrayed as a scarab beetle or scarab-headed man, maybe in fully anthropomorphic form with a scarab-symbol above his head.
The scarab is widely popular Egyptian symbol but only few have idea what it symbolizes. At this point a question may come up: what is the connection between the creator god and the scarab? The answer could be found in the reproduction-cycle of the scarab. The beetle places its eggs into the clod it rolls and the new entity will stay there during its entire period of growth. When it comes to daylight from the clod we can see the fully grown-up, adult entity. That's why the Egyptians thought that the scarab was something that comes alive from the lifeless and creates something living from the dead material. So it became the symbol of the self-creating life, the creation and renewal.
The other dimension of his role relates him to the regeneration that ties him to the sun and Ra, the Sun god. In this context Khepera represents a phase on the daily journey of the sun. He is the rising sun, the renewed, rejuvenated, revived Ra. This role is also referred to in the inscription on the stele of Thutmosis IV, which stands between the front legs of the Great Sphinx. According to the inscription Khepera is the guardian of the necropolis and the Sphinx is his tomb. The Great Sphinx faces the East; it has observed the rising sun since many millennia. It focuses its sight to the point where Khepera appears every morning. In his inscription Thutmosis IV refers to him also as the god of immortality.
In Boleslaw Prus's novel "The Pharaoh" an entire army is led out of its way and a canal built with the sweat of a lifetime is filled up with sand in order to avoid a holy scarab that a soldier saw on the road. The priests don't want to take the risk that the army may trample down the holy animal. Maybe this episode is exaggeration. We don't know how much the Egyptians worshipped the animals related to a certain god. There are some allusions, but these are different about each animal. It is sure the animal in which the god takes shape was considered to be sacred but not equal to the deity.
In the case of the scarab I suppose the incident described in the novel seems to be realistic.
The scarab was widespread religious symbol in Egypt and maybe the most popular amulet. We can often see it as part of jewellery, and royal pectorals. Despite Khepera very rarely appears in sight. He is a mysterious figure of the Egyptian pantheon. The popularity of his insignia is in contrast with the mystery of his personality, but on the other hand we have to take into consideration that the Egyptian did not take note of the things obvious for their mind-set.
This may be the reason why Khepera's role and mythology did not remain in written resources. Maybe he was not worshipped as a separate god, only as an appearance of Ra and his cult melted together with the sun cult.
Khepera (in the middle) on a wall painting from the tomb of Inehertawy (Deir-el-Medine, 20th din.).
A naos shaped pectoral belonged to General Undebaudet. It is full of symbols, and the middle part shows the winged Kehpera, holding the royal cartouche up to the skies.
Tutankhamun's pectoral features the winged Khepera. The symbols appearing on this jewel form the hieroglyphic word Nebkheperura: the coronation name of the Pharaoh.