Part of many cat's personalities is independence. Since most cats can fend for themselves, are very good hunters, and cautious by nature they may not be very social. Or in pet terms, they just do not care if you want them to do something; they do what ever they want.
This really irritates some people to no end. They want to have a pet that responds to their directions. For the most part, my advice for those people is to get a dog. But cats can be social or friendly with a little training. I'm not absolutely sure they may really mean it but they will at least act like it.
Two things all animals respond to food and affection or positive reinforcement. Many animals will not respond to punishment or physical discipline, especially cats. So the best method I've found is to bribe them. Many cats who are sooner to hissing or even threatening to strangers do so because at one time or another they were mistreated. Cats are not very trustworthy to begin with and any memory of a bad situation just confirms their belief that all strains may pose a threat.
I've spent a lot of time rescuing abandoned or feral cats and in order to catch them and find them a home you need to gain their trust. Food and patients are your only means of trying to restore that trust. Some who were recently abandoned are pretty easy; cats who were born feral are a lot tougher. Sometimes it takes up to 6 months of constant work to bring them around. A few never adapt depending on their age and natural disposition.
But if you have a cat that is aggressive or hides when company comes, you have a cat with a social problem. Some may not even have had a bad experience; they are just suspicious of anyone. You may never completely eliminate the problem but you can make some serious progress. It does take a little work and effort.
One of my best tricks is to get the stranger to offer the cat some food that they especially like. Obviously you need someone to help in this type of training. And you may have to take it in very small steps. The food is offered to the cat, if they still do not calm down or if they still run away, set the food down in a neutral area. Not to close but not to far away. Over time the cat will come out or stop the aggressive behavior, inch by inch.
The room needs to be quiet, no sudden movements by anyone, and once you put down the food you need to pay no attention to it or the cat. The food has to be irresistible and I try not and feed the cat for a few hours before the training exercise. Most of my experience shows that on the first few times you may have to put the food down and back away at least 20-25 feet, giving the cat a clear escape route. Slowly but surely you move the food closer to the person.
Once the cat starts taking the food right in front of the person, they need to slowly try and pet the cat. No fast or sudden gestures, and just one or two strokes to start with when petting. Once the cat starts recognizing that they will get food and attention from a stranger, they will start being friendlier.
Aggressive cats require very quick reactions just in case. Never put yourself at risk, I've seen a cat shred someone's hand or ankle in nothing flat. And on the scardy cat problems, you need to start eliminating the far away hiding spots. Give them somewhere to hide but keep it close so they can smell the food and get used to new people being in the same room.
Like I mentioned, this may take months of working with the cat. Repetition will get results but you need to be patient with the cat. You are trying to overcome a basic insecure (that may be justified) and these behavior modifications are slow to stick. And some may never totally overcome their problems but most do improve. I had one especially aggressive feral cat that started out as one mean son of a gun. Within a few months he would come up and rub against people. Now you still had to keep any eye on him, but he would not beat up other cats (he also used to beat up dogs too) or take a swipe at people who went to pet him anymore.
One of the key factors on finding a rescue cat a home is that they learn how to bring around new people and quickly adapt to their new family. And a cat that will attack people is definitely not a good thing for visitors, human or animal. Positive reinforcement and a little effort can make a huge improvement on cat social skills.