It’s a condition in which a person can have, Repetitive thoughts, Images or impulses. The repetitive thoughts can be about cleanliness, religion or sexual content. The person tries to resist it but unable to do so. This can lead to compulsive behaviors of hand washing, checking rituals or any other repetitive behavior.
If the symptoms are long standing and impacting life then it might be Obsessive compulsive disorder. It’s a treatable condition. This can be managed with medication and psychotherapy.