I like comparing our mind with a child. When we tell kids not to do something, they will either do it when we’re not watching, or it may create a conflict.
The same happens to our mind. Sometimes we may get a thought. Especially a negative thought. And it just stays in our mind, we cannot get rid of it. The more we try not to think of it, the more we think. Like, don’t think about pink elephant.