Apep was the ancient Egyptian deity who embodied chaos and was thus the opponent of light and order. Ra was the solar deity, bringer of light, and thus the upholder of order. Apep was viewed as the greatest enemy of Ra, and thus was given the title Enemy of Ra, and also "the Lord of Chaos".
As the personification of all that was evil, Apep was seen as a giant snake or serpent leading to such titles as Serpent from the Nile and Evil Lizard. Some elaborations said that he stretched 16 yards in length and had a head made of flint. Tales of Apep's battles against Ra were elaborated during the New Kingdom.
Since everyone can see that the sun is not attacked by a giant snake during the day, every day, storytellers said that Apep must lie just below the horizon. This appropriately made him a part of the underworld. The wide range of Apep's possible location gained him the title World Encircler.
It was thought that his terrifying roar would cause the underworld to rumble. Myths sometimes say that Apep was trapped there, because he had been the previous chief god overthrown by Ra, or because he was evil and had been imprisoned.
Ra was assisted by a number of defenders who traveled with him, including Set and possibly the Eye of Ra. Apep's movements were thought to cause earthquakes, and his battles with Set may have been meant to explain the origin of thunderstorms. In some accounts, Ra himself defeats Apep in the form of a cat.