Because it brings in more money for the school. More people watch sports like football and basketball rather than watching swimming or soccer. More people means more money at the gate. It also means that more people can see advertising, so that can be sold, which also raises money for the school.
Schools may fund one sport more than others due to popularity of the sports, their level of competition or the participants available. Sports are used in schools as a means of nurturing talents and also create recognition.
Sometimes schools can't afford to fund more than one sport other times they just like funding the sport they find most important. Sometimes they have parents help fund sports and since they can force a parent to fund whatever sport the school wants the parents will fund the sport the want.