A 2.5 year old doesn't have a lot of empathy, understanding of causing pain to others, or a well developed sense of values, but they do know what gets a reaction out of people and, well, it's kind of important to exert a bit of control over others sometimes. It's one way of expressing an overwhelming feeling (usually frustration) they may be having difficulty dealing with.
They are not yet old enough, though, to participate in protracted discussions of how this causes pain to people, isn't good behavior, etc. so repeated conversations trying to get him to see that this isn't acceptable is likely to be unproductive.
There may be some clues to look out for. Is he doing this when he's especially tired or overstimulated? When he's not getting something he craves? When he's with a lot of people or when not getting any attention? Looking for patterns may help you prevent the behavior in the first place with adequate rest, etc.
On the other hand, hurting people is not OK. To get this across, you need to react immediately and consistently with a consequence. He's not too young for a "time out".
My first son started to bite at 2.5 years, right after the birth of my second child. I tried the usual (requests, talks, admonishments, exaggerated pain, etc.) with little effect. It's only when I started to simply say, "Biting is not OK. Time for a time out," and immediately remove him to his room (or the car if we were away from home) that he learned to stop.
After the time out, there was time to talk about what brought on that behavior, and to propose better ways of dealing with the situation. To do this, kids need to have an adequate emotional vocabulary. He needs to be able to name emotions like anger, sadness, frustration, etc., before he can discuss them, and follow that with a discussion about how to deal with these emotions in a healthier way.
Adequate attention throughout the day, ability to express emotions, avoidance of triggers, teaching alternatives, positive reinforcement of desired behavior, and consistent consequences for hurtful behavior should be a good start.