Pesticides are sprayed and kills a lot of the population
Among the survivor, they are less susceptible to the pesticide
In the next generation of beetles. a lot carry this same resistance gene as the surviving population
After a few more sprays of the pesticide, these resistance beetles, descendant of the original mutant beetle, out number the rest of the population
Now the entire population is immune to this pesticide