The Egyptians believed that before the world was formed, there was a watery mass of dark, directionless chaos. In this chaos lived the Ogdoad of Khmunu (Hermopolis), four frog gods and four snake goddesses of chaos. These deities were Nun (Nu) and Naunet (water), Amun and Amaunet (invisibility), Heh and Hauhet (infinity) and Kek and Kauket (darkness). The name of the water of chaos was Nun.
Nun
It was from Nun that Ra (or Amun, another of the Ogdoad who became prominent Middle Kingdom onward, and joined with the sun god as Amen-Ra) created himself, rising up on the first piece of land - the primeval mound (Benben) out of the lotus blossom, born from the world egg, or as a bnw-bird who then found and landed on the mound. In another story, it was Thoth who awoke from Nun and sang the unnamed four frog gods and snake goddesses who then continued Thoth's song to keep the sun travelling through the sky.
The First Time then began and Ra was thought to have created the universe, including his children - other gods. He brought Ma'at - order - to chaos. Nun was thought to be the father of Ra, who was known as the father of the gods.
Your offering-cake belongs to you, Nun and Naunet,
Who protects the gods, who guards the gods with your shadows.
-- Pyramid Text 301
One story says that Ra's children, Shu and Tefenet, went to explore the waters of Nun. After some time, Ra believed that they were lost, and sent the his Eye out into the chaos to find them. When his children were returned to him, Ra wept, and his tears were believed to have turned into the first humans. Nun then became the protector of the twin deities, protecting them from the demons in his waters. Later on, it was Nun who suggested that Ra sent out his Eye to destroy the humans who were in contempt of the sun god. Finally, it was on Nun's orders that Nut turned into a solar cow, and carried Ra up into the sky after the sun god had grown old and wearied of life on earth.
Nun was thought to exist both outside the universe and as part of every body of water from the Nile to temple pools. The Nile itself was thought to flow from Nun's primordial waters. He was thought to play a part in the rituals involved in laying out the foundation for new temples.
Nun was also thought to continue to exist as subsoil water beneath the earth and as the source of the annual flooding of the Nile River.
-- Encyclopædia Britannica
The god was shown as either a frog-headed man, or as a bearded blue or green man, similar in appearance to Hapi, but wearing the palm frond (symbolising long life) on his head, and holding another in his hand. He was also shown rising up out of a body of water, carrying the solar barque in his up stretched hands.
Though Nun was a being of chaos, he was thought to have a beneficial side rather than the serpent of chaos, Apep, Ra's enemy. The Egyptians believed that Apep had been created when the goddess Neith spat into Nun - her spittle turned into the serpent-demon.
The god of chaos didn't have a priesthood, nor any temples that have been found, and was never worshiped as a personified god. Instead, he was represented at various temples by the sacred lakes symbolising the chaotic waters before the First Time. At Abydos, he is represented by an underground water channel at the Osireion.
The Ogdoad were the original great gods of Iunu (Heliopolis) where they were thought to have helped with creation, then died and retired to the land of the dead where they continued to make the Nile flow and the sun rise every day. Iunu was thought to have been the site of the primeval mound by the priests of the city, and they had a sacred lake known as 'The Sea of Two Knives' and an island known as 'The Isle of Flames'. The lake, attached to a temple, represented Nun's waters, and the island was believed to be the primeval mound itself. Ra was thought to have come into the world out of the giant lotus which grew on the mound:
Out of the lotus, created by the Eight, came forth Ra, who created all things, divine and human.
In Hikuptah (Men-nefer, Memphis), Nun was linked to the creator god, Ptah, and known as Ptah-Nun. Thus both Ptah and Nun were thought to be the father of the sun god Atem, and also thought to be more powerful than the god. He was the 'Heart and the Tongue of the Ennead' (the one of intelligence who had the power to command), and thus the one who was in control, with the sun god being placed a step below the creator god of Hikuptah.
The priests of Waset (Thebes, Modern Luxor), on the other hand, declared that Waset was the site of the Nun's water, and the rising of the primeval mound. Amun, the creator god of Waset, was originally one of the Ogdoad and became the most powerful god of the area. They believed that Amen changed from the invisible chaos deity into the primeval mound. In this form, he created the other gods. He created the lotus, which opened to reveal the child form of Amun-Ra, who then finished the creation of the world. Nun, although he was a powerful force, was thought to have been inert until Amen awoke him from torpor, and used his chaotic waters to create the universe.
Naunet
Naunet (Nunet), on the other hand, is more obscure than her husband. She was thought to be a snake-headed woman who presided over the watery chaos with Nun. Her name was exactly the same as Nun's, in hieroglyphs, but with the feminine ending for a goddess.
In Hikuptah, she was imagined to be the mother of the sun god, as Nun was the father, combined with Ptah, creator god of the city:
The gods who came into being in Ptah:
Ptah-on-the-great-throne --------.
Ptah-Nun, the father who [made] Atem.
Ptah-Naunet, the mother who bore Atem.
Ptah-the-Great is heart and tongue of the Nine [Gods].
-- Shabaka Stone
The Egyptians of Khmunu believed that the world was surrounded by mountains that helped support the sky, but at their feet was Naunet. They imagined that Ra appeared from these mountains, being reborn daily from the watery abyss.
Naunet was the feminine to Nun's masculine, more of a representation of duality than an actual goddess, so she was even less of a deity than Nun, and more of an abstract.
One day, it was believed that the waters of Nun would eventually inundate the whole world, and once again the universe would become the primordial waste of Nun's chaotic waters.