I know from experience that it is possible. The first time I hatched mine, it was actually a girl.
I don't know if you're unlucky, per say. Did you save before ever getting the egg, right after the gym battle, and reset? Or did you receive the egg and then save? If it's the latter, that would be why because the contents of the egg are already determined at that point.
If you saved before receiving the egg, then you're just not getting it yet. Keep on trying. Stay patient.
Thank you for your time.