Your child does not have any concept of time at his age, and having to wait for five minutes to have his turn on the swing can really be overwhelming for him. To encourage your child to share, behave this way yourself. If he asks for a bite of your chocolate, then give him a bite willingly. Sharing household chores with your child is also another way of teaching him to share - you are cooperating and doing the job together. Playing games as a team too will teach your child cooperation.
Talk to your child about the benefits of sharing as well. Tell him that the more he shares with others, the more they will want to share with him. If there is something in particular that he does not want to share then ask him why. It could be that he is scared his kid brother breaks his toy, or that someone will take it and not give it back to him. Very importantly, if you expect your child to respect your possessions, then you should show respect for his possessions as well.