It’s called Intrusive Thoughts, and apparently most people have these:
London psychologist Stanley Rachman presented a questionnaire to healthy college students and found that virtually all said they had these thoughts from time to time, including thoughts of sexual violence, sexual punishment, “unnatural” sex acts, painful sexual practices, blasphemous or obscene images, thoughts of harming elderly people or someone close to them, violence against animals or towards children, and impulsive or abusive outbursts or utterances.[6] Such bad thoughts are universal among humans, and have “almost certainly always been a part of the human condition”.[7]
Louis C.K.