Your kid has come to an age where he has started developing a brief understanding about how they should behave in public. They observe how you behave in public and more or less adept to your ways of socially adaptable behavior.
What you need to know
You are the role model for them and they look up to and others for how to behave and treat others. As your kid has just started understanding the norms of societal behavior, it is your responsibility to help them mold accordingly.
You want your child to be well behaved and you can do this by bringing discipline at your place first. The way your kid behaves at home will ultimately be the way he will be having outside too.