Thanks for taking the time to reach out for some help with your parenting question! It definitely sounds like your little boy's behavior has been upsetting and confusing for you, to say the least. Whenever a child knowingly does wrong it can be upsetting for a parent to see; you obviously want your son to behave appropriately and respectfully.
When your son engages in inappropriate behavior it is very important that you respond firmly and consistently with a negative consequence. When using discipline, try to follow this format:
1) Explain to your son which behavior was inappropriate and why he shouldn't have done it.
2) Give your son a consequence.
3) Talk with him about ways he should have acted instead (appropriate behaviors).
4) Practice this appropriate behavior with him.
5) Praise the practice.
6) Let him go on about his day.
It can be difficult to start using firm, consistent discipline if you haven't been already but it really is important. You can expect it to be met with some resistance at first, but if you make it clear to your son which behaviors he shouldn't be doing and what the consequences will be it really goes a long way towards making those expectations known and easier to follow. Remember, firm and consistent is key!