Because the law1 says that companies must check the visa required by the passenger at the destination country. If they do not do that, they may get fined2.
This is not even a law particular of the USA, but based in the Chicago Convention on International Civil Aviation(https://en.wikipedia.org/wiki/Chicago_Convention_on_International_Civil_Aviation), that specifies:
Article 13: (Entry and Clearance Regulations) A state's laws and regulations regarding the admission and departure of passengers, crew or cargo from aircraft shall be complied with on arrival, upon departure and whilst within the territory of that state.
Also, in the best practices:
5.9 The aircraft operator shall be responsible for the cost of custody and care of an improperly documented person from the moment that person is found inadmissible and returned to the aircraft operator for removal from the State.
5.14 Contracting States shall not fine aircraft operators in the event that arriving and in-transit persons are found to be improperly documented where aircraft operators can demonstrate that they have taken adequate precautions to ensure that these persons had complied with the documentary requirements for entry into the receiving State.
This kind of question appears regularly at Travel Stackexchange, with people complaining that they have been denied boarding (not only towards USA, but any other country3) due to visa issues.
1BTW, this had nothing to do with 9/11. It works this way in all the world, and AFAIK it did work that way well before 9/11.
IIRC, post-9/11, there were additional requirements so that any passenger boarding a plane that went over the USA had to fill a form before the flight to get clearance, even if he had visa or if the destination of the flight was not the USA.
2And, in top of that, the airline will have to provide transportation back to country of origin to the rejected passenger (although they may try to sue him for the value of the travel).
3Check this example where the destination was Brazil. Or this one with a Vietnam destination. Or this one with a Schengen one.
If you got curious, search the site for "boarding denied visa" and you will get lots of questions and answers.