They are in a normal, possessive egotistical phase where they're just beginning to understand their independence from you.
As they crystallize the idea that some toys, books and clothes belong to them, they tend to exaggerate and assume EVERYTHING belongs to them. (I know some adults who still have trouble with this!)
Don't forget this is happening just as they are also learning to test the boundaries of your rules, values and discipline.
So what should you do to encourage your child to share with others at the playground, give up a few toys during a play date and not throw a fit shouting "Mine!". Experts on the website What to Expect, have some good ideas.
First don't force it. It's the carrot vs. the stick approach. Gently suggest that your child share a toy with another child when they ask for it but DON'T require them too. Just tell the other child or parent "this is a special toy, so Zeke may not be willing to share but we have a lot of other toys you can play with."
Certainly applaud small steps. Give your child positive attention when they do share "You gave Hunter a turn. That was so nice." When children feel secure, they're less likely to hoard because they know they'll get a turn again soon. With my twins, they have a built-in sibling they have to share with. I clearly tell each one, "It's Zeke's turn now; it's Hunter's turn now. Zeke will get another turn next. Then Hunter can have the truck after that."
Explain the idea that other people have possessions too. "These are Mommy's sunglasses, but you can see them." As they get older, lovingly ask how they would feel if someone kept their crayons or grabbed their shovel. Explain that it's more fun to play together when everyone shares.
Use a timer to give tangible proof of when each person's time is up. Don't forget to put the timer high enough up that neither child can reach it and change the time (as my twins are quite willing to do).
Good luck with learning to share. And if all else fails, just know real sharing doesn't happen until children are age 3 or 4.