He is two and playmate is the same age. They play well together but the playmate rebuffs hugs- how do you handle that?
I love that you asked this because I had the same issue with my one son and a child he played with nearly daily of the same age. I just kept interceding. You have to. Even though they are small and likely mean no harm, it's not totally all innocent. This is not terribly different than toy snatching or other behaviors you want to put an end to. It is unwanted, non-consensual contact.
I would (over & over & over) go to him, remove him from the other child and say "Hugs are only nice when we want them". This has to be paired with you never making him hug anyone if he prefers not to, not even grandma when she is leaving. In order to teach a child that all touch is consensual based only, you must also allow them freedom to say no to touching & hugging too.
Also as an aside, watch when he does this. As I watched closely, I noticed my son may have been doing it to be a stinker. The more the other child wanted him to stop, the more devoted he was to trying. Any behavior out of the other boy he didn't like, such as a toy snatch or a hit, would then elicit a hug reaction. I think he genuinely was a hugger overall and did like hugs. I also think he caught on it irritated some kids and used it that way too though.
And if you are diligent & keep telling him how he needs permission to give a hug and when someone says "no" you have to stop, he will stop. It takes a little time, like all unwanted behaviors, but it did stop. And when you are interceding & reminding & telling and it feels like they will never "get it", trust yourself to know they will. You don't teach ABC's in a few lessons, it takes doing it over & over & over. It is the same with children learning proper ways to interact with other kids. Repetition might be irritating and tiresome, but it's not pointless, you will get there.
Do nothing. Pick your battles and tackle the actually important issues: behaviours that truly pose a danger to others or himself. Teaching a toddler to be prim and proper is beyond Victorian!