The easiest way to deal with begging is not to let it start in the first place. Never feed your pug from the table or offer him scraps while you're cooking. As it is, your pug will already be constantly underfoot in the kitchen, hoping for a dropped tidbit. Don't permit it. It's not only annoying, it's dangerous. You could trip over the dog while you're moving around in the kitchen, injuring one or both of you. Teach him to stay in an out-of-the-way place or put his crate in the kitchen so he can watch but not participate in meal preparation.
Training classes won't magically solve all your pug's behavior problems, but they can increase the bond between the two of you, as well as increase your dog's confidence, making him more willing to work with you and less likely to behave fearfully.
If you can't resist giving your pug a treat while you're preparing a meal, make him sit or do a down first. Then send him back to his place. No hanging around hoping for more. Only give him treats when you've called him to come and then required a sit or down.
Feed your pug before the rest of the family eats. He won't be quite as hungry (though pugs are always hungry, or at least willing to eat), and he'll be less likely to bother you at the dinner table. If he's allowed in the room while the family is eating, put him in a down/ stay. And, of course, there's nothing wrong with putting him in his crate during mealtimes.
Pugs are playful by nature, but behavior problems must be corrected before they turn into bigger issues.