Thanks for this great question!
I don't think that God has a body, and so accordingly can't be male or female. You are not the first person to ask this question - the rabbis throughout history have asked the same question and struggled with the gendered language in the Bible. And for good reason: in the Bible God walks in the Garden, appears in physical form before Moses, and has other worldy encounters. In fact, Maimonides, one of the greatest scholars of Jewish history, wrote a book that largely tried to explain away references to God doing anything physical.
I think that the Bible represents the best wisdom of its time, and it speaks to our ancestors' search for God. In their mind, they needed a God who was physically present. That is why they built the Temple in Jerusalem and offered sacrifices. Today, we understand better that God has no body, and because of that can't be male or female. We often use male language because Hebrew is a gendered language, but not because we believe that God is actually male. In fact, I like to pray using feminine God language too.
For me, instead of saying Melech (King), I often say Ruach (spirit). Or instead of saying Baruch atah adonay I will say Bruchah at yah (the feminine version of that same language). It is easy to include feminine language in our prayer, and better reflects the idea that God is many things, and transcends gender.
A very good question. We also do not know if God is tall or short, slim or heavy, red-head or black-haired, young or old. The more questions we ask about God, the more we realize that they are impossible to answer.
What we do know from Jewish thinkers is that God cannot be described, that God is not male, God is not female. God has no gender, because God is not a person like you and me.
The reference to God as He, Him, His, are manners of speech. God is also described in female language, as in shekhinah – the Godly presence. They are all interchangeable, because God has no gender.
If God had a gender, he/she would no longer be God.
What we actually have here is a language problem, not a gender problem.
God does not have a body, the way people do, so God doens't have a gender. The prayer books and the TaNaKh reflect the fact that people use language to speak, and many languages are strongly gendered. English, unusually, is not a strongly gendered language, but Hebrew is, and both our prayer books and the TaNaKh reflect that they are translated from Hebrew - in which not only God gets a gender, but so do chairs, tables, body parts, food, pencils... you get the idea: everything in Hebrew is a "he" or "she" for the purposes of speaking, even though that's rather silly when you think about it. Hebrew, however, has no "it," so our choices are to either choose a gender to label God, or call God "God" everytime we refer to God.
Some people do this (I do it myself, sometimes, when I talk about God in English). It can be a bit clunky, though.
Sometimes, in English, I refer to God as "She." Many people find this a little shocking the first time that they hear it because they're not used to it. Sometimes, I alternate back and forth between "He" and "She" - I don't use "It" for God, even though it might be more accurate, because in English, "It" usually denotes something inanimate - a thing, like a chair- which would be disrespectful to God.
The great commentator Maimonides wrote that when we talk about God we have a problem, because our minds and languges are human, and thus limited. We, with our puny human brains, don't really understand God, so the best we could accurately do would be to say what God is not. So, for example, when we say that God is compassionate, what we really mean is that our limits allow us to understand that God is not cruel.
Our language is limited the same way: we may know that God isn't human, but we have trouble understnding it, so when we talk about God, we say "He" or "She," but the reality of God has nothing to do with being male or female - or any other characteristic of our limited human physical existence.
As usual, a young person asks a question that is both awesomely interesting and incredibly difficult. Nonetheless, I shall attempt an intelligible, even if inadequate response.
No matter our particular notions or descriptions about deity, I am convinced Judaism insists that we are obligated to take ideas about G-d very seriously and, equally, critically. So much so, in fact, that our tradition recognizes that anything we say, in whatever language we may say it, is simply insufficient to describe what we mean. Simply put, G-d is greater than language.
To be more specific, the masculine pronoun is an expression we may use. It is a function of and reveals the limits of language and not a description of G-d at all. In fact, many people try to avoid masculine or feminine in any discussion about or in addressing deity. They believe gender neutral language provides a more honest way of saying that which is more than we can ever say with any precision. I mean to suggest, then, that G-d is more than a he, a she or both, and our tradition embraces the notion that G-d is more than any language may ever hope to describe.\