L.D.
He could be frustrated, in which case, it's good to label the feeling so that he can learn to express it in another way eventually. It could also be a bit of what they call "attention seeking" on his part. When you say "No" and he hits himself, you (no doubt) have some sort of reaction that he may find amusing and enjoyable -- after all, all eyes are on him now. If that's the case, then just ignore that particular behavior -- don't act shocked and don't say anything to him -- and the behavior will phase out soon enough because it will cease being fun and games for him.