Why does every inanimate object have a gender in french?
Gender is a feature commonly found in a strong majority of European languages. A much more relevant question would be why English does NOT have it. Unfortunately, the only answer I have to that is, "just lucky, I guess."
Old English had gendered nouns as well, but lost them (I believe) following the Norman invasion of England, following which English got heavily mixed with French (which is why, to this day, 60% of English vocabulary comes from French).
French, of course, also has gendered nouns, but the genders were not the same as in Old English as in French. In the mixing process, the genders were lost.
A similar process, incidentally, took place with Afrikaans (which started off as Dutch, but was very influenced by French and other languages). Dutch has gendered nouns; Afrikaans does not.
Gender is used to identify articles. It's not just for gender like "boy" or "girl" same with many with most languages. English does not have a grammatical gender. The only gender that is identified is only between boy and girl. Gender should not be focus on the most, gender is learn during the learning process. So all you need to do, is remember each article a word has when seeing it.
You won't learn it right away. French has two genders. Definite gender la/le/les- the and in-definite un and une-a/an.
Gender is also useful for telling orthographically identical words apart.
La tour = the tower, watchtower while
Le tour = the tour, journey, the circuit, the rook (in chess) and several more.
La Tour d'Eiffel vs Le Tour de France are somewhat different ☺