Why is the majority muslims in Egypt while Christianity came to egypt a long time before Islam?
You might ask why Egypt was ever Christian when traditional Ancient Egyptian polytheism involving worship of Horus, Osiris, Isis, etc, came to Egypt a long time before Christianity. Everywhere in the world that is currently Muslim was something-other-than-Muslim before Islam existed, whether Christian, Zoroastrian, or Tengrist. (And everywhere in the world that is currently Christian was something-other-than-Christian before Christianity existed.)
The early Rashidun Caliphate invaded Egypt in 639, wresting it from the Byzantine Empire. The Byzantines had been weakened by a long, devastating war with the Persians (who were also weakened by the war, and fell completely to Muslim invasion), and Egypt was, at any rate, discontented with the religious policies coming out of Constantinople (the disputes are a little hard to understand for someone who isn't a hard core Christian theologian, but it has to do with whether Christ had two natures, a human nature and divine nature, or whether Christ had one nature that was simultaneously human and divine. Probably for your average Egyptian it was more about the perception that Constantinople was acting like an overbearing bully than the details of Christology). So the Byzantine Empire was in a weakened state, and Egypt at the time didn't have a particularly strong sense of loyalty to the Empire.
Initially, the Muslim conquest of Egypt did not, of course, turn everyone in Egypt into a Muslim. In fact, under the Umayyads, conversion of "locals" to Islam tended to be discouraged, because the Umayyads intertwined a sense of Arab nationalism/chauvinism with Islam, and preferred the idea of an Arab elite ruling over the Christian/Zoroastrian heathen over the equality (and loss of tax revenue from more heavily-taxed non-Muslims) that more widespread Islamization would imply.
Under the Abbasids and later, more and more members of other religions converted to Islam. The official religion was Islam, and although most of the rulers of Egypt were somewhat tolerant (with some notable exceptions, such as the Fatimid Caliph Al-Hakim, who persecuted Christians (along with Jews and heretical Sunni Muslims) quite harshly), there were advantages to being a Muslim.
I'm not sure anyone knows on what year Muslims became he majority in Egypt.
hi! you may be interested in these posts
a couple of threads in Wednesday AMA: Massive Egypt Panel: one and two
How accurate is this video about the Muslim conquest of Egypt?