A.F.
At that age, he is starting into what people have called 'the terrible twos' ...the months surrounding the 2 year birthday. It happens to all kids, just on different schedules and in different manners: the developmental thing is that he's beginning to differentiate himself from you,understanding that he is a unique individual, and that other people are also people, not just aspects of his environment. That's a lot for a little guy to understand, and it mostly comes out as some form of rebellion or "NO!" behaviour. (Meaning, he'll say 'no' no matter what you ask him, just to prove that he isn't part of you... then be frantically hurt if you had offered him a cookie, and he said no, then he didn't get it ;D)
You have to be on the ball. Sorry, but that's how it is with a 'hitter'. You'd be mad if another Mom didn't stop her child from hitting yours, right? And understand, this is teaching him the very basics of compassion and caring for others. When he goes to hit, hold his hand so that he can't. "We don't hit in our house. We use words. I won't let you hurt someone else. How would you like it if someone hit you?" You must be firm, and mean it. If he tries a second time, then you say "No. I told you we don't hit here. You must be tired. You can stay in your room until you are ready to play without hitting." One chance, then withdrawal. No backing off.
Of course, he will throw a temper tantrum. too bad. "When you are ready to join us without hitting you may come out." -You have the strength and the size now to teach him this without him getting hurt, and it's always best for them to learn early on that the parents mean what they say and that consequences follow behaviour. You don't want to be dealing with a variation on this theme when he's a teen.
About me: I just turned 50, raised two active boys, the oldest is 23, married, owns a house and is established as an engineer(he finished both high school and college ahead of schedule). The youngest just started at University.