Pretty sure it's an common symptom of OCD, it doesn't mean he has any sexual attraction towards other men or children and it certainly doesn't mean he is going to act on it. (Not that there is anything wrong with being gay)
It sounds almost like Tourette's of the mind