The creation of the universe (Heliopolis Theory) took place over a long period of time when the gods lived on earth and established kingdoms based on the principles of justice. When the gods left the earth to reside in the sky world, the pharaohs inherited the right to rule.
The Book of the Dead, dating to the Second Intermediate Period, describes how the world was created by Atum, the god of Heliopolis, the center of the sun-god cult in Lower Egypt. In the beginning, the world appeared as an infinite expanse of dark and directionless waters, named Nun. Nun was personified as four pairs of male and female deities. Each couple represented one of four principles that characterized Nun: hiddenness or invisibility, infinite water, straying or lack of direction, and darkness or lack of light.
God Atum created himself out of Nun by an effort of will or by uttering his own name. As the creator of the gods and humans, he was responsible for bringing order to the heavens and the earth. As Lord of the Heavens and Earth, he wears the Double Crown of Upper and Lower Egypt and carries the ankh, a symbol of life and a was scepter, a symbol of royal authority.
According to the Pyramid Texts, written on the walls of pyramids, the creator god emerged from the chaotic darkness of Nun as a mythical Bennu bird (similar to a heron or phoenix). He flew to Heliopolis, an ancient city near Cairo, where, at dawn, he alighted on the Benben, an obelisk representing a ray of the sun. After fashioning a nest of aromatic boughs and spices, he was consumed in a fire and miraculously sprang back to life. The capstone placed at the top of an obelisk or a pyramid is associated with the Bennu. Called a pyramidion or the Bennu, it is a symbol of rebirth and immortality.
Atum created His son, Shu, represented dry air, and his daughter, Tefnut, represented corrosive moist air. The twins symbolize two universal principles of human existence: life and right (justice).
The twins separated the sky from the waters. They produced children named Geb, the dry land, and Nut, the sky. When the primeval waters receded, a mound of earth (Geb) appeared, providing the first solid dry land for the sun god, Re, to rest. During the dynastic period, Atum was also known as Re, meaning the sun at its first rising.
Geb and Nut produced four offspring: Seth, the god of disorder; Osiris, the god of order; and their sisters, Nephthys and Isis. This new generation completed the group of nine deities that began with Atum, the primeval creator god.