The match appeared destined for a goalless draw until deep into added time when the Egyptians thought they had stolen victory through Juan Bezerra.
However, VAR intervened and ruled the goal out for handball in the build-up, before awarding a penalty to the hosts instead.
Ahmed Khaldi calmly converted from the spot in the 98th minute to hand the Algerians a crucial first-leg advantage ahead of the return clash in Cairo.
Zamalek were further frustrated after Mahmoud Bentayg was sent off for dissent during the dramatic scenes.
The Egyptian giants must now overturn the deficit in the second leg if they are to lift the Confederation Cup title.
