While the US government issues documents that work for identification everywhere (called passports) approximately nobody living in the US actually has a passport.
So when planes began to be attacked by bad guys some decades ago, the aviation industry (regulated at the federal level, because it doesn't take long to fly out of the state you start in) decided to use the identification document that everyone does have: the drivers license.
But those are issued by the states, not the federal government.
And the states don't all do a great job of the surveillance state stuff, so it's pretty easy for a budding Mr Terrorist to get a drivers license, and for his state to not bother keeping much in the way of records to find him if he ever hijacks a plane.
The solution to this falls under the category of the US "trying everything before they get it right" -- the federal government (via congress) decided that only drivers licenses issued by states that get the surveillance stuff right to their satisfaction would be usable to get on a plane (passport always worked and still works, fwiw).
Some states said "ok, that's fine". Some states said "nope, not doing it". <insert years of wrangling> The final solution was that the "not doin it" states were told they could issue two kinds of drivers license (real-id and...un-real-id).
Since you have to explicitly request a real-id license in those states, which costs more, and because people are lazy and ill-informed, there are still people with no valid id document to get on a plane.
So now we get to the present day where the solution to that problem is to not let them on the plane. Oh...wait, no, the solution is to charge them $45.