system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: If we kill bacteria using medicine, how do they become resistant to the medicine if they're dead?
gpt
Evolution.

Imagine a house that has a rat infestation.  So as the disgruntled homeowner, you buy a bunch of mousetraps and lay them down.  You find great success with eliminating the rodents at first, but there are some smaller and nimble mice that can contort their bodies to get out of the mouse traps.  Over time, all the fat mice die out while the nimble ones survive.  Then, the nimble mice reproduce with each other, producing even more nimble mice that can wriggle out of the traps almost effortlessly.  By this point, almost all the fat mice have died out.  Once the next generation of nimble mice reproduce with each other, this new generation produced is *sooo* nimble that the mouse traps are basically useless.  So now there are the same amount of rats as there were originally, except the mouse traps don't work.  Now you have to go out and buy even stronger mouse traps.

In the case of your question, the rats are bacteria, the traps are antibiotics, and the house is your body.  It's not the dead ones that become resistant, it's the ones that survive that reproduce to breed a resistant strain.  Except since bacteria is constantly multiplying, it creates new generations very quickly.  It's essentially evolution on steroids.