Is the rent a car thing in law or just a car company policy?
Car rental is a private service, not a protected right enshrined in the Constitution, so car rental companies are free to set their own pricing policies, as long as it's not arbitrarily discriminatory.
But why 25? Well, here's the rub:
Once upon a time, insurance companies got together to comb over public accidents statistics and discovered that the vast majority of dumb-ass accidents involved drivers under 25 years old, so they decided that drivers 25 and over should get the best insurance rates.
This decision directly lead to car rental companies offering 25 year olds the "normal" rental prices, and that's the demographic they specifically caters to.
For the record, the vast majority of car rental companies today still offer rental to people between 21-24. They just don't go around trumpetting that service. A few of them even provide their service to 18-20 year olds.
The kicker here is that these young drivers under 25 will have to swallow the daily "Young Renter" surcharge fee, which often bring the total cost to doubles the "normal" rates, to cover for all the accidents and damages that younger drivers are notorious for.
It's all about business economics here, and it will continue to be that way as long as people under 25 kept getting into car accidents at much higher rates than people over 25.