Hug scenes in anime transpire for a variety of reasons, both romantic and platonic. They can serve as the dramatic climax of a series-long relationship, showcase a character's emotional development, or simply come off as silly and awkward.
Hugs are a vehicles for expressing love, be it friendly, romantic, or familial. Some of the best anime hugs are heartwarming, while others are heart-rending. All Might of My Hero Academia has no problem showing his support for his students with hugs, whereas the hug shared by Hana and her werewolf lover in Wolf Children is enough to bring even the most hardened anime fan to tears.
A well placed hug can change the course of an entire series, assuming the person on the receiving end is happy to be touched.
Despite being a show about ninja battles, Naruto has moments of surprising emotional resonance, and the hug shared by the titular character and his mother is one of the most powerful. Naruto's parents both died shortly after his birth, so he never got to meet them, and their absence left a painful void in his life. Through the magic of chakra, Naruto is eventually able to reconnect with both of his parents, but only for a brief moment.
Before the magic fades, he experiences what it's like to be hugged by a mother for the first time in his life, and he gets to hear how much both of his parents loved him.
Hunter X Hunter features a particularly heartwarming hug between siblings Killua and Alluka Zoldyck. More specifically, it’s between Killua and Nanika, the Dark Continent creature that possessed Alluka, and that now shares a body with her.
Unlike the rest of the Zoldyck family — who simultaneously fear Alluka and want to control her incredible wish-granting powers — Killua actually loves his sister, though he doesn’t particularly care for Nanika. What he fails to realize is that, for Alluka, a rejection of Nanika is a rejection of herself; she doesn’t want to be loved by someone who can’t love every part of her. The hug between Killua and Nanika is the visual proof that he has finally grasped this truth, and has come to accept all aspects of his sister.
While some might consider a teacher who hugs their students slightly sketchy, in the case of All Might from My Hero Academia, it's just his way of showing how much he cares about his pupils. After the sports festival (an event on par with the Olympics at UA High), All Might gives each of the winning students (except Bakugo, who isn't down for such things) a congratulatory hug, along with advice on how to improve both their physical prowess and emotional state.
The touching moment showcases the students' growth as would-be heroes, and also shows how All Might is progressing as a teacher.
Attack on Titan is typically pretty brutal, so it's not surprising that one the series's most emotionally intense hugs takes place after what looks like certain tragedy. Eren Jaeger appears to have been killed and eaten by a Titan, and his adopted sister Mikasa Ackerman is understandably distraught. When his unconscious body is recovered from the Titan, she tearfully embraces it, unsure if the person she had sworn to protect will survive.
Later, it is revealed that the Titan actually was Eren, but that's a way longer story.