I think that would be a history/etymology lesson going all the way back to Latin. I haven’t studied Latin, but I think there used to be a lot more grammatical genders, but they were gradually merged into one another in languages with a Latin heritage.
Why the neutral gender got merged into masculine and not feminine is a good question. Maybe it was just because they were the most similar.