In many languages (including Hebrew) most nouns have a strong gender component—but the gender assignment is grammatical and does not necessarily indicate the physical gender of the object. In Spanish, a guitar (la guitarra) is feminine, and a car (el coche) is masculine. This has nothing to do with literal gender. For example, the Spanish word masculinidad, which means “masculinity,” is a feminine noun! Therefore, when translating from Hebrew into English, we must distinguish grammatical gender from our notions of sexual gender.
Another example is the English wisdom is grammatically neuter, but not so in Hebrew. The Hebrew word is chokmoth, and it is grammatically feminine. In Hebrew, it would have been natural to speak of wisdom as a “she.” That is why the book of Proverbs personifies wisdom as a woman.
With regards to God, the Bible informs us that God is neither male nor female:
“God is spirit, and his worshipers must worship in spirit and in truth” (John 4:24).
Since God is a spiritual being, He does not possess physical human characteristics. However, sometimes figurative language used in Scripture assigns human characteristics to God in order to make it possible for man to understand God. This assignment of human characteristics to describe God is called “anthropomorphism.”
“Anthropomorphism is the attribution of human traits, emotions, or intentions to non-human entities. It is considered to be an innate tendency of human psychology.” https://en.wikipedia.org/wiki/Anthropomorphism
Anthropomorphism is simply a means for God (a spiritual being) to communicate truth about His nature to humanity, physical beings. Since humanity is physical, we are limited in our understanding of those things beyond the physical realm; therefore, anthropomorphism in Scripture helps us to understand who God is.