Natural selection. Those that survive will have better more favorable traits (for the disease of course) and will live to reproduce.
The one most at fault are doctors for overprescribing antibiotic and those that do not take the full dosage of antibiotic that they are prescribed. If you do not finish out your prescription, you allow the antibiotic resistant bacteria to survive which allows them to spread with more resistance