It's pretty common, a lot fish do this.....
Like most things in the hobby, there are a wide spread of theory's and opinions as to why our little friends seem to be losing their minds!
Rule out your water first, measure your nitrates maybe it's time for a water change - do a complete analysis: ammonia - nitrite - nitrate and ph. You want to eliminate that is an issue with the water...
If your water parameters are off, change your water... or you could just perform a water change (after checking the parameters) I'm sure he'd appreciate it even if your parameters are okay.
Have you observed if the fish is eating properly? If he is not eating, I'd watch him closely and get a hospital tank on standby in case this is related to a physical issue - it's probably not, but not eating is an earlier sign of illness.
Many people believe the fish sees his reflection and thinks it is another fish......
Some say it's stress but that almost always leads to less eating if the stress is not corrected.
Not sure if there is a definitive answer to your question, but more often than not IME it's just a normal activity some fish undertake and in my fish it does eventually cease on its own.
Enjoy your fishes!