The man was quickly subdued by the guard and others who rushed to help and is being questioned, the official said.
The incident came days after Egypt's Christian minority leaders said they were suspending some activities such as conferences and religious trips for security reasons.
Islamic State group jihadists have killed dozens of Coptic Christians in church bombings and shooting attacks in Egypt since December, and have threatened further attacks.
"We're still checking," the official, who requested anonymity, told AFP when asked whether the suspect in today's incident was an extremist.
More From This Section
CCTV footage of the incident showed a man wearing earphones and with a bag trying to enter the church when he was called back by a guard who asked to check the bag.
The man took out a knife and slashed the face of the guard, who quickly recovered to subdue his attacker with the help of others.
Yesterday, a man stabbed two German women to death and wounded four other Western women in an attack at a Red Sea beach resort.
He was arrested and is being questioned by police.