He had anger issues and depression at different points in his life.
The episode Orientation, shows that he joined an anger management group therapy class in 1995.

The episode The Man from Tallahassee shows that Locke later suffered from depression.
LOCKE: You think I'm temporarily disabled?
GOVERNMENT WORKER: Depression can be temporary, yes. And since you see fit to stop going to therapy, I guess you're all better.
LOCKE: [stands up] Guess I am.
While it's possible he had some form of OCD or something similar, there's no way to know for sure.