The Académie tried to codify what was used at the time (which varied a lot) to try and create a standard, but that's why there's so many exceptions to the rules everywhere : they went with "tradition" when creating the system instead of logical rules or purer phonetical approach (which some proposed).
There's a bunch of info on the wikipedia link about it, and how each wave or "réforme" tries to make it simpler (while still keeping the old version around as correct).
Each one is always hotly debated/rejected by parents too when they see their kids learning the newly simplified rules.
Recently, the spelling of onion in french went from "Oignon" (old spelling with a silent I) to "Ognon" (simplifying it out), and event that one made me have a "hmm" moment ;)