Lawrence Wright’s book, the Looming Tower, goes into this in great detail. It’s a grim but properly gripping and brilliantly researched read. He rightfully won the Pulitzer for it.
Essentially internal politics and competition between the CIA and FBI led to known terrorists being let through the border. It was then too late.
John O’Neill, the FBI agent who spent years tracking and trying to prevent them getting into the States left the FBI, became head of security at the World Trade Center and was killed on 9/11. Tragic.