While most French/Spanish noun cognates share the same gender (both descending from the same vulgar latin root), there are many exceptions having opposing genders (e.g. la couleur / el color; la douleur / el dolor). What explains this divergence?
1. This Quora answer, Dan Lenski (BA Linguistics; PhD Physics) lists but also explains one.
2. The Genders of French and Spanish Noun Cognates: Some Statistics and a List., Teschner, Richard V.,
Canadian Modern Language Review, v43 n2 p256-66 Jan 1987.
3. Wordreference