The Quran says that there is nothing like Him, and that He neither begets nor was begotten. Gender belongs to created living beings that reproduce. Since Allah has no origin, no partner and no offspring, Muslims reject any idea of Him as a male or female person. This is also why Muslims do not make images of Allah.
Arabic has no neutral word like 'it' for a person or a being, only masculine and feminine, so the speaker must choose one. The masculine is also the default form when the sex is unknown, mixed or beside the point. This is the form the Quran uses for Allah, and English translations follow it, though it is only an approximation. Some writers in English avoid the pronoun by repeating 'Allah' or 'Allah' instead.
Allah is described by names of majesty and beauty, such as the Merciful, the Forgiving and the Loving, and the Prophet Muhammad ﷺ taught that He is more merciful to His servants than a mother is to her child. The comparison with a mother shows how deep His kindness is; it does not say that He is a mother. Islam also teaches that men and women are alike in the sight of Allah in worship and reward: He promises a good life and a reward to every believer who does good, male or female.