Maybe it's scared, take it out for a walk ,cool it down
Like at the wall maybe? Kind of like they are lost and/or confused? Does he ever seem to be staring into space, maybe a little forgetful (or even seems he can't hear as well)? It may be your pup has doggy dementia/alzheimers (Cognitive Dysfunction Syndrome). You should talk to your vet about it.