Because with one simple gesture and without words you have told the person receiving the hug many things.
The hug says - hello, how are you, I'm not going to hurt you.
The hug says - I'm so glad you're happy, a celebration is needed.
The hug says - I care about what just happened - neither you nor I, are alone, together we cannot be broken.
Why are hugs magic?
Because - the action of compassionately by impulse or intent embracing a person or animal says - in this moment you and your needs are important and someone truly cares.