L.D.
My son, at 2 -21/5 had a biting problem which happened at daycare and mostly when he was playing or in unstructured times.
The teacher said, "No biting - biting hurts" and put him in timeout. He then had to apologize.
At night, when I rocked him, I talked about his day in general. If it was a day he had bit, I would talk to him about that. We also would say "No biting - biting hurts" when we dropped him off at daycare.
Its hard because at that age, they are such "in the moment" little people that even though they know it is wrong they still do it.
Eventually, my son outgrew it, and I think your son will outgrow the hitting. He does it now, probably because he is frustrated and it is the only way he knows to get a toy back. You can talk to him about taking turns and about sharing and asking to use a toy which might help. Also, model NOT hitting to get something you want and have him practice at home.
Dont worry!