The 25-year international is the third major summer signing for Masry since the reelection of businessman Kamel Abu Ali as club president in late July.
Abu Ali has vowed to improve finances inorder to rebuild the popular Port Said-based side that suffered last year.
In April, the team exited the African Confederation Cup in the quarters finals then narrowely escaped relegation from the Egyptian Premier League, finishing the season in 13th place.
Last week, Masry named the experienced coach Ehab Galal to guide the team in the new season - in a second stint for him with the club.
Abu Ali also signed two Alegerian players: ES Sétif midfielder Abderrahim Deghmoum, 23, and Wydad defender Imadeddine Boubekeur, 26, to bloster its squad.
Hamdi played last season with the Alexandrian side Semouha on loan from Zamalek, delivering outstanding performances to end the league competition second on the top scorers table with 15 goals.
He had joined Zamalek in January 2021 from Maqassa, scoring three goals for the White Knights in 25 appearances in all competitions, before being loaned by the club to Semouha in October of the same year.
Hamdi netted one goal in 11 appearances with the Pharaohs since he made his international debut in 2020.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)
Short link: