They were conquered a few times in different ways. I think no there was an ethnically non Egyptian dynasty between the old and middle kingdoms. One of the more notable pharaohs reclaimed independence and Egyptian rule. I’m having trouble recalling the exact details. There were also numerous civil wars. Power struggles between upper and lower Egypt or between pharaonic power and local power.
Then in this order they were conquered by Libyans after years of border skirmishes. Egypt was pretty weak at this point. It must have been around 800-600bc. The Libyans did some pretty extensive and systematic grave robbing. Then came the Persians. Achaemenid dominance didn’t last long, but they did manage to build a sweet canal from the Nile to the Red Sea. Then came Alexander. This wasn’t much of a military conquest and the Egyptians recognized Alexander as a true pharaoh and established a pharaonic cult with some legitimacy. The Ptolemaic dynasty lasted until cleopatra until ~40bc
The Egyptian language lived on in some form as Coptic. The writing system that evolved over millennia as hieroglyphs, hieratic and then demotic was adapted to Greek and Latin symbols. I find that to be fascinating in itself because Greek and Latin alphabets have characters that may be traceable back to hieroglyphs or hieratic.
Sorry for any factual inaccuracies, this is just what I can remember from one read through of one summary of Egyptian history!