1) You are not a "bad" person for having such thoughts. That is just another thought. You are not your thoughts.
2) Don't judge yourself about it, that's - you guessed it - just another thought.
3) Developing mindfulness (vipassana) and concentration (samatha) will allow you to catch the moment where your strong emotions get triggered and simply observe, without judgement, and let it go. It will be 1 time in 10 at first, then 2, 3...
4) You develop those by establishing and adhering to a meditation practice. The basic instructions are very simple so I won't reproduce them here, just search for vipassana meditation or samatha meditation; I recommend you go heavy on samatha (concentration/calm abiding) for the first year or so, and build a strong base from which to develop the mindfulness side of things.
All it takes is faith in the process, commitment and consistency. Your mind will be transformed by this in ways that are hard to imagine if you have not been through the process.