Do not think of God in anthropomorphic terms, at least not when talking about all the Abrahamic religions. God has no sexual organs or functions. We cannot castrate Him. He has no gender at all, because He has no body.
The reason we refer to Him as Him is because our languages were formed in a gendered society. We, humans and not God, refer to things as either male or female, even inanimate objects. Few are the languages that would have a pronoun for “it,” but even then it would be considered derogatory. Notice that in English, which has an “it,” we still use “he” or “she” for things we would normally use “it” if we did not hold these things dear to ourselves. Example: America is served well by “her” citizens. Or, “she” is my cat, or, “he” is a loyal dog. Notice that we used she for a cat (a non-trustworthy animal) and he for a dog (man’s best friend), unless she is a bitch (a female dog, another interesting choice of words).
In Semitic languages, as far as I know, there are no pronouns for “it.” Things are either male or female, with the highest orders being referred to in the masculine pronouns. However, and this is interesting, and I am speaking more of Islam and Arabic about which I am more familiar than Judaism and Hebrew, things are not as they appear in English. Allah, as a proper name, has no gender. While it appears masculine in language usage, you cannot derive a feminine form from it. The is no “Allahah,” and if you make it “al-Ilaha” then it is not a proper name anymore. An expert in the Arabic language might want to comment on this, whether right or wrong.