The human brain is an amazing organ. What we most associate the brain with doing is thinking. It assimilates a tremendous amount of information, and processes it in a multitude of ways, such as cognitive thinking, memory recall, and decision-making.
The brain processes so much information that it is not uncommon for us to experience random thoughts, or intrusive thoughts, unrelated to any of our values.
Most people experience intrusive thoughts without any significant consequences. But for a few people, intrusive thoughts are more severe and can make it difficult to function normally day to day.
Read more on lifehack.org