The oldest god was the Sun god, Re. During the Old Kingdom, kings built their pyramids to worship Re. But each region also had its own gods. For example, the main god of Thebes was Amun. So when the capital of Egypt moved to Thebes, Amun became more important.
Amun was then combined with the Sun god, Ra, as Amun-Ra. (Amun-Re)