While a vast majority of men who wear hats indoors are just boorish yahoos, there are any number of reasons to wear a hat indoors which are perfectly valid. Two that quickly come to mind are:
1) Religious reasons. Orthodox Jews (like my late f-i-l) always cover their heads indoors and out. In his case, he chose a regular baseball cap to a yarmulke.
2) Medical reasons. Perhaps the man has a rather ugly looking scar on his head from surgery and wishes, for reasons of modesty and good taste, to hide it from the public.
I understand. Thx.