This is because the word "mairie" is derived from the word "maire," meaning "mayor," which is masculine. In French, nouns derived from masculine words are often feminine.
This is because the word "mairie" is derived from the word "maire," meaning "mayor," which is masculine. In French, nouns derived from masculine words are often feminine.