Your LO might be frustrated when he is unable to communicate, and at this age, he is coping and learning with new emotions(angry, sad, happy and etc), at time he might be overwhelmed and unable to handle the new emotions. Hugging it’s good, however if your LO doesn’t want to be hugged during that period of time, do let him express his emotions(crying) alone at a safe and quiet corner. After he feels better(stopped which may takes awhile) then you can hug and comfort him. I do allow my LO to cry (when she is sad or upset)at her quiet corner, I will tell her to let me when she is ready (stop crying) to talk or feels better. After that I will hug, comfort and explain what had happen and how she can manage better next time. Has been doing this since she has become a toddler. Until now at 2y10m, she will tell me “Mama, I have finish crying”, then we will hug and I will ask her why she feels sad or upset, how she can manage it better next time or explain to her why she couldn’t do certain things. She can handle and manage her emotions well at her age because we allow her to express and we will try to help her to handle.
I think this is natural development for toddlers, they are often frustrated as they can't communicate their needs to us very well yet, but at the same time they are getting more expressive. We should get used to more tantrums during this age. Maybe when he's angry he doesn't want to be hugged so forcing him would be counterproductive. Give him some space to sort out his emotions but just be around if he needs you. Let him know it's OK to be frustrated sometimes.
Distracting them and being playful or talking to them and taking their mind away from whats bothering them at that point has worked for me