I'm going to make the case solely for English. I don't know if other languages would have the same answer, and I think it's quite likely that the answer to this question is somewhat language-dependent.
So English no longer has grammatical gender. The pronouns we use are strongly linked with natural gender. This also means that the pronoun it is seen as depersonalising. For instance, consider that non-binary individuals never (as far as I know) want to be known by the pronoun it, instead they want us to use they. The only time it feels remotely acceptable to use it for a human is for a unborn or newborn baby whose gender we don't know yet.
So English-speaking Trinitarian Christians think that using the pronoun it is depersonalising towards the Spirit. We want to stress that the Spirit is as much a person as the Father and the Son, so we never use it for the Spirit. They would be a much better option for the Spirit than it, though it hasn't seen any widespread acceptance. The question then is which of the other two pronouns, he or she, should we use for the Spirit?
So the words in the Biblical languages for the Spirit are רוּחַ, which is a feminine noun, and πνεῦμα which is a neuter noun. But sometimes other nouns are used for the Spirit, such as παράκλητος, which is masculine. Is the Holy Spirit gender-fluid, switching between a feminine gender identity in OT times and a neuter or masculine identity in NT times? No. Instead we'd recognise that in a language with grammatical gender nouns along with their pronoun agreement do not always indicate natural gender. For example, consider the German word Mädchen, meaning girl or young woman (up to the age of 20). Wiktionary explains that this noun is neuter, and in many cases the pronouns or other agreement must also be neuter:
Since Mädchen is a grammatically neuter noun, all preceding articles, determiners, and adjectives take neuter forms: ein kleines Mädchen (“a little girl”). This rule is followed throughout all registers of German.
There is more variation concerning pronouns referring back to Mädchen. These are usually neuter within the same sentence: Das Mädchen, das eben hier war, hat seine Tasche vergessen. – “The girl who was just here, forgot her purse.” (But feminine ihre would be acceptable in colloquial usage.) It is quite common, however, to use feminine pronouns in following sentences: Siehst du das Mädchen, das da steht? Kennst du die? – “Do you see the girl who [neuter] is standing there? Do you know her [feminine]?” (But neuter es would be acceptable in literary usage.)
This is how languages with grammatical gender work. Individual words have an assigned gender, even though they may not have anything to do with natural gender. (Indeed, they should arguably be called noun classes instead of genders.) And when you use a noun with one gender to talk about someone with a different natural gender, the pronouns, adjectives, verbal agreement, etc, match the gender of the noun, not the person. (Some think that the NT sometimes uses masculine pronouns for πνεῦμα, breaking grammatical agreement, but this is disputed even by conservative Christian scholars.) As another example, when Jesus talks about his soul in John 12:27, he uses a feminine article, ἡ ψυχή, but we wouldn't take that as indicating that Jesus is transgender, with a female soul in a male body. Instead it's just how Greek works. ψυχή, like most abstract nouns, is grammatically feminine.
So the gender of the nouns רוּחַ and πνεῦμα do not necessarily indicate the gender of the Spirit as a person. And the fact that God inspired the use of two major terms for the Spirit with different grammatical genders (along with additional lesser-used nouns that are masculine) strongly implies that we should not take these words as indicators that the Spirit is feminine or neuter.
So what should we say then? Well lets start with the genders of the Father and Son, which are more straightforward. The Father is not a man, but he is in a sense male and masculine. The preferred way he has revealed for us to conceptualise him and to refer to him is with the male parent, Father. And though there are a few passages which use feminine and motherly symbology to refer to God, the main metaphor is Father instead. The scriptures are God's self-revelation, so when God inspired the scriptures to call him Father, we should understand that this is in some way a true revelation of who he is. We should actually think of fatherhood and fathers as being flawed pictures of God the Father; God the Father is not like one of our human fathers, instead our fathers are like God the Father. Fatherhood is not primarily about sperm and motherhood is not primarily about eggs. And though both fatherhood and motherhood are expressions of God, when God decided how to inspire his people to talk to and about him, he decided that Father is much more fitting than Mother. I don't think we have a clear reason why, but I'd posit that it might be because of the begotten-not-born relationship of the Son to the Father. If Mother were the most appropriate eternal title of the first person of the Trinity then we would be led to think of the eternal birth of the Son. Calling the first person Father does not eliminate the idea that the Son was created, but I think it's a little less confusing, because birth is just too salient to the idea of mothers.
So for the second person of the Trinity, prior to the incarnation, there was perhaps a much bigger case to be made that this person should be understood as feminine! The book of Proverbs talk about the personified Wisdom of God, which many, perhaps most, Trinitarians think is referring to the Son. But more than just one title of grammatical gender, these passages are extended pictures of the Wisdom of God playing a feminine role in society. Despite this, with the incarnation we understand that the second person is the Son of the Father, who became a human man, and is to be referred to with masculine pronouns forever more.
The case is weakest for the Spirit. The Spirit takes the most behind-the-scenes role in the scriptures and is not given a title that aligns with a clear human gender like the Father and Son have. But because the three persons collectively are addressed as God in the scriptures and are given the masculine pronoun in those times, most Trinitarians conclude that we should also use the pronoun he for the Spirit.
Genesis 1:27 (NIV): So God created mankind in his own image,
in the image of God he created them;
male and female he created them.
When God made us in his image he made us male and female. Both masculine and feminine are expressions of the image of God, pictures of God in some way. Women are no less the image of God despite God revealing himself in predominantly masculine ways. And without a clear Biblical reason to consider the Spirit to be feminine (aside from the feminine רוּחַ, which I have already shown is not a good reason), most Trinitarians would say that the Spirit too should be referred to with masculine pronouns, as befitting the dominant masculine self-revelation of God. I'd say that it's not impossible we're getting this wrong, but given the lack of clear feminine self-revelation of the Spirit in the scriptures, then if we are wrong God will not fault us. Personally, I think I could tolerate someone else using they for the Spirit, even though I wouldn't use it myself, but not she or it.
But as I said at the beginning, this is how English-language Trinitarians reason. Just as the Greek NT uses neuter pronouns most of the time when talking about the πνεῦμα, churches in other languages may use pronouns which agree with the grammatical gender of their language's word for Spirit, or the pronouns may differ depending on what the sentence is saying. But just as no one thinks that a Mädchen is a neuter human, this does not mean they think the person of the Spirit is not masculine. In many languages pronouns just don't match natural gender.
https://christianity.stackexchange.com/questions/36977/is-the-gender-of-the-holy-spirit-feminine-or-masculine
https://christianity.stackexchange.com/questions/16856/did-any-groups-or-noted-theologians-in-early-christian-history-teach-that-the-ho
– Peter Turner Feb 03 '22 at 04:48