As mentioned by dr. W- indiscriminate use of antibiotics (abx) creating an environment only resistant bugs can grow.
This can be prevented in several ways -1. Use abx for the appropriate indication, 2. Achieve source control, 3. Use abx for as short of a period needed to treat a disease. Other factors contributing to resistance is its use in poultry and cattle, and a false sense of security.