What languages were spoken in ancient Egypt?

Primarily the Pre-Coptic dialect of the Egyptian language.

They spoke a language that today we call "Egyptian", though it must have had a different name in ancient times.

It's in the Afro Asiatic family. It was one of the first recorded languages in history, and it was spoken all the way up until around the late 1600's AD as a form of Coptic.

After the Ptolemies took over, Greek became the language of Alexandria and of the educated classes.
the ancient Egyptians spoke Arabian and wrote hieroglyphics.
The Egyptians of ancient Egypt spoke various forms of Ancient Egyptian. Arabic became the language of Egypt after the Islamic Conquest.
Ancient Egyptian
There was one main language of ancient Egypt. Today we call it "Ancient Egyptian". In its time, it may have had a different name. The written form of the language is today called Hieroglyphics.
Scholars break it down further, based on time:
  • Archaic Egyptian (before 2600 BC, the language of the Early Dynastic Period)
  • Old Egyptian (2686 BC - 2181 BC, the language of the Old Kingdom)
  • Middle Egyptian (2055 BC - 1650 BC): characterizing Middle Kingdom (2055 BC - 1650 BC), but enduring through the early 18th Dynasty until the Amarna Period(1353 BC), and continuing on as a literary language into the 4th century AD).
  • Late Egyptian (1069 BC - 700 BC): characterizing the Third Intermediate Period (1069 BC - 700 BC), but starting earlier with the Amarna Period (1353 BC).
  • Demotic (7th century BC - 5th century AD, Late Period through Roman times)
  • Coptic (1st century AD - 17th century AD, early Roman times to early modern times

Today, Egyptian Arabic is the main language of Egypt.