This is the same kind of anxiety I have. This sounds a lot like OCD or an anxiety disorder. Consider the following: thoughts can not be immoral, actions can be. Your mind is your own playground to do whatever you want in, and if the thought of killing bugs is what comes into your mind, thats merely you experimenting with the idea. It says nothing about your character besides your curiosity. There's a reason why thoughtcrime has historically been an idea in dystopian novels: our thoughts are not entirely in our control. We can vaguely guide the flow with some willful control, but the river will flow whether we like it or not. Don't shame yourself for your brain functioning exactly as it should. We have ideas and then we crosscheck those ideas with what our ideal self would be. Your ideal self would disapprove, as evidenced by your concern over this. It is admirable that you clearly care so much for your wellbeing, but the energy is misplaced. The more energy you put into the moral value of these mere thoughts, the more valid they will seem to your brain. Intrusive thoughts are ultimately uncomfortable, but they have no power over you unless you give them it.
note: most people dont give a shit about bugs, me included. the urge to get rid of a bug or other small invertebrate is totally normal. if having these thoughts makes you a murderer... then everyone else is genocidal.