There is some logic to it.. or so the thinking goes:
In the bible maleness is a God thing before it's a human thing. It's not that God chooses to be male, it's the other way round, what we call male conveys something fundamental to the reality of God that has existed for all time and independent of everything else. When God makes the first human, he's male, because he's in God's image (not that God invented maleness to create Adam, instead God's imprinting something of his eternal self onto his creation, and we call that eternal quality "male"). Likewise when the Word becomes flesh, he's male.
Stands to reason that all the other heavenly creations of God (his messengers, "angels", including the "angel of the lord" which always appears as a man) are all what we'd call male. But this isn't in a procreation sense, that's something that was given to Adam. Rather the idea is that there's something fundamentally "ideal" about the pure essence of masculinity in ancient Jewish thought.