
Egyptian mythology is not unified and many different regions of Egypt had their own variations of the religion. The one presented here is the most standard one.
The ancient Egyptians were mostly polytheistic,although the pharaoh Akhenaten believed only in the sun god, Ra, and attempted to convert the entire nation to his monotheistic religion, this attempt failed as the religion was abolished after his death. They also believed that their leader, Pharaoh, was a god. Pharaoh literally means 'Great House.' The main god of the Egyptians was Ra, the sun god. The Egyptians did have an afterlife, which was, essentially, an extension of a person's life.
The beginning is marked, in Egyptian mythology, with boiling water and chaos. This boiling water was called Nu. Eventually, land came out of Nu, followed by Atum or Ra. Ra mated with his shadow and spit out his son, Shu, and vomited his daughter, Tefnut. Shu was air and represented life, Tefnut was rain and represented order. Ra was separated from his children at some point. When they returned, he cried, and thus, life was created from his tears. Tefnut and Shu gave birth to Geb, who was the god of the earth, and Nut, who was goddess of the sky. Geb and Nut created the gods Osiris, Isis, Seth, and Nephthys.
In Egyptian mythology, Apophis/Apep was the serpent-like dragon, most often depicted as a hooded cobra, that daily attempts to catch and destroy the sun god Ra.Apep was an evil god, the deification of darkness and chaos and thus opponent of light and Ma'at (order/truth), whose existence was believed from the 8th Dynasty.
Apep formed part of the more complex cosmic system resulting from the identification of Ra as Atum, i.e. the creation of Atum-Ra, and the subsequent merging of the Ogdoad and Ennead systems.
Consequently, since Atum-Ra, who was later referred to simply as Ra, was the solar deity, bringer of light, and thus the upholder of Ma'at, Apep was viewed as the greatest enemy of Ra, and thus was given the title Enemy of Ra. As the personification of all that was evil, Apep was seen as a giant snake/serpent, or occasionally as a dragon in later years, leading to such titles as Serpent from the Nile and Evil Lizard.
Though because of his size considered to be a 'python' by some Egyptologists, this identification does not square with texts that mention Apeps 'poison' and never mention an act of strangling.
Apophis was often thwarted by other gods, such as Shu, Tefnut, and Seth. When Apophis did eat Ra, his belly was cut open and Ra would emerge.