He is not yet able to fully "share" as is expected of him, or as compared to other kids.
He will adapt, in time.
He is being also territorial, which many 2 years old are and do.
If he is still in this phase.. .then perhaps, just take him to another area of the playground... and do something else with him. Also, he does not 'have to' share his things either. Its okay. He has a sense of 'ownership' developing and 'fears' that his toy will disappear etc. These are literal thoughts of a toddler. It is real for them.
My son, when he was that age, would think that if he "shared" or gave something to another kid or his sister... that he would NEVER EVER get it back. He "worried" about his toy... at this age, the difference between "temporary" and "permanent" giving... is not yet totally understood. So, thus, they don't want to share.
Teach him about "manners" versus, an either/or type of thing. Not about "sharing" per say or him having to do it. A child this age is also trying to exert "boundaries" and may not want to share. They don't have to.... nor even just out of perfunctory gesture. For my kids, if out at a park, if they don't want to share something, I don't force it. I tell the other kids, "no, they don't want to share right now. Its okay, Its theirs and is special to them... maybe later."
For me... personally, I think it is important, for my kids to develop a sense of "boundaries"... because later, it will enable them to navigate themselves against people/situations that are inappropriate.
Your son is age appropriate... but the whole "ability/mastery" of him being able to "share" without conflict will develop... maybe just not yet. But try not making the whole "sharing" thing unpleasant or a point of punishment. Otherwise, they will equate "sharing" with being BAD and unpleasant.
Role-play with him... about manners and scenarios. Teach him HOW to "ask permission" for a toy, teach him WHAT TO SAY... in simple ways... not wordy sentences. A 2 year old, needs examples to go ALONG with the gesture. And teach him how to communicate... his needs AND irritations as well... thereby helping him to cope with "anger" or disgruntled-ness, and that YOU will listen and he will realize that having feelings, is okay, and that he can say it and will learn to navigate himself... in time, in a more palatable way. Praise him when he does do things pleasantly.
Time-outs for sharing/non-sharing is not going to solve it. There is also the emotional/developmental ability too.
All the best,
Susan