I'm OK with hugs as long as it's not too sudden and intense. In fact I enjoy them.....it reassures me that the other person finds me acceptable enough to wrap their arms round me. I don't know exactly why I can't cope with sudden hugs. If I'm going through a phase where it's not happening much, although that often makes me feel deprived and wanting it to happen more, when it does happen it tends to be more of a shock, and then I can't easily respond gracefully.
I've felt some of that sexual anxiety mentioned by other posters here, especially if I'm not used to hugging. I'm particularly reluctant to hug men....I get a fleeting impression that everybody would think I was gay......I'm sure there are ways to make a "man-hug" so obviously masculine that nobody would think any such thing, but I'm not confident of being able to use those ways, so I usually don't bother (sorry guys ). Frankly I have very little experience in hugging men, because they don't often seem to want that anyway. I'm not homophobic, just that I don't want to join in, so to speak. I think it could be a fear of making a homophobe think I'm coming on to him......I've hugged gay men and not felt anxious at all, just a little concerned that they might get their hopes raised when there's nothing I can do for them.
The sexual anxiety can happen when I hug women too. Some of them seem to have a good hugging style, they'll kind of lean forwards so that they're not pushing their boobs into my chest, and they'll carefully present their cheek so that a kiss on the lips or neck would be impossible without being rather aggressive. But others stand upright so the entire front of our bodies is in contact, which I see as very untoward unless we're pursuing a legitimate sexual relationship. So if I've got a partner and/or she has, I can feel quite strange and gulity about it. I really don't know what's going on - whether they're "right" and there's nothing sexual in it, or whether they know full well that there are sexual connotations to what they're doing but want to keep it kind of secret.