But
surely it is good to kill sometimes. To kill disease-spreading insects,
for example, or someone who is going to kill you?

It might be good for
you. But what about that thing or that person? They wish to live, just as
you do. When you decide to kill a disease-spreading insect, your intention
is perhaps a mixture of self-concern (good) and revulsion (bad). The act
will benefit yourself (good) but obviously it will not benefit that creature
(bad). So at times it may be necessary to kill but it is never totally good.