Whereas animals, and even some plants, have gender differences, God is a spirit. We use gender-specific words–when referring to the Trinity–only for our convenience.
Most human languages are rooted in gender-related words. Originally, this probably came from the fact that certain items were used more by one gender than another. For example, “the table” in Spanish “la mesa” is feminine, probably because it was women who traditionally set and tended the dining tables.
Today such gender terms are becoming meaningless as traditional roles are breaking down. However, it is difficult to refer to a person without some gender language.
In Hebrew and Greek, the word for “Spirit” is feminine. It was only when the Bible was translated into Latin that the Holy Spirit took on a masculine gender.