Hamas is a Moslem Brotherhood created front group. The Egyptian government hates Moslem Brotherhood and vice versa. Ditto for Hamas allies Palestinian Islamic Jihad (PIJ).
Both terrorist groups are supported by Shia Iran, despite being Sunni. Sunni Egypt does not get along with Shia Iran, at all.
Egypt is worried that Hamas and PIJ members will try to escape into Egypt with the refugees and then seek to overthrow the Egyptian government (again).
@FearlessModerate
I've left out quite a bit of other details but I hope this answers your very good questions.