Yes, Egyptian criminal law applies to everyone physically present in Egypt, regardless of nationality. Under Article 3 of the Egyptian Penal Code (Law No. 58 of 1937), the provisions of the law apply to any person who commits a crime on Egyptian territory — there is no exemption for foreign nationals or expats.
This means that if you commit an offense in Egypt, you can be arrested, prosecuted, and sentenced under Egyptian law just as an Egyptian citizen would be. Your home country's laws offer no protection while you are on Egyptian soil, and your embassy can assist you consularly but cannot shield you from Egyptian legal proceedings.
As a practical matter, expats should familiarize themselves with Egyptian law before assuming that behavior legal in their home country is permitted in Egypt. This includes laws around alcohol, public conduct, photography of government buildings, and online speech. When in doubt, consult a locally licensed Egyptian attorney.
This is general legal information, not legal advice. For advice on your specific situation, consult a lawyer licensed in Egypt.