It can be very upsetting as a parent to not receive a hug. Now, sometimes your child doesn't want to hug you because they feel like it, and their not in the mood, and if they're telling you that then clearly there's not an issue there except that they rather play and do something else.
However, if you're feeling your child is not hugging you because they're really physically withdrawing themselves from you as if they are in pain or they're in discomfort when being held by you that could be a concern.
It could be a number of things. One of them being that it's too much physical input for them. One of them being that they're not able to process that feeling and one of them being that they're not engaged with you, and that could be a cause for concern.
What's important is that you observe their behaviors, and if it becomes something like a pattern and you're seeing it often you should discuss this with your pediatrician.
It could be that your child would require further developmental evaluations to assess what's going on, but it is important to share your concerns with your pediatrician first.