The short answer is that the Aviation and Transportation Security Act, passed by the U.S. Congress following the September 11, 2001 terrorist attacks, requires that for all flights originating in the United States, passenger security screening be conducted by a federal government employee. The same act created the TSA to oversee the screening process, and the TSA considers the identification check before entering the checkpoint to be a part of it.
Airlines provide the names of their passengers to the Terrorist Screening Center, a governmental unit administered by the U.S. Federal Bureau of Investigation (FBI), who then check the names against various lists of suspicious characters. Individuals on the so-called No Fly List are not permitted to board an aircraft within, to, from, or over the United States. The ID check ostensibly confirms that the individual passing through the screening is the same person as named on the ticket.
Obviously, someone with malevolent intent could obtain false identification documents and make it through screening, and indeed the 9/11 Commission Report notes multiple occasions where terrorists obtained and used fake IDs. Still, the requirement that the ID be government-issued adds a barrier, and the report also notes incidents where questions about ID led the would-be terrorists to flee, or be subjected to additional searches. Perhaps this is enough to justify the process from a political standpoint.
The requirement that screening be done by a federal employee was a reaction to low standards in the hiring and training of airport security workers prior to 9/11. For the most part, the screeners were contract workers hired by the airport or airline, and their interest was therefore to make the screening as fast and easy as possible, rather than thorough.
Later reports that some of the hijackers had invalid identification but were still allowed through (along with other security breaches), and that many of them were known to the FBI but that no warnings were passed on to the FAA or the airlines, led to very intense political pressure 1) to federalize airport screeners in order to enforce national standards and to provide Congressional oversight and 2) to have stronger enforcement of ID requirements. Such measures had bipartisan support— the only quibble was over whether the screeners should be allowed to unionize.
Not all measures which had widespread support in the months after 9/11 have proved to be unalloyed goods, even for "security theater," but such debates are outside the scope of this Stack and I do not take a position in them.