My current PI is telling me that I am a very shy person and he is really pissed off, what I should do? Today in the lab we had a birthday, I had participated, but not so much as I feel anxious in crowded areas. I felt very shy and that's true, so I withdrew from the party after 15 minutes and wished everyone well.

Later, my PI informed me that he is extremely pissed off and did not like the fact that I am a very shy person. I am supposed to select a potential supervisor; the one whose work I am interested in also has also a shy person. The PI (head of the lab) informed me that he cannot assign two shy people to work together (me and the prospective supervisor) as he thought we are going to fail to make significant work.

The ugly truth is that I am an indeed shy girl for many years and I lose many social opportunities, likely marriage opportunities because I don't interact so much as other girls. However, I look very confident in voluntary works, teaching and giving talks.

I know it sounds controversial, however, I began to lose my self-confidence and esteem although I had a strong character. 

The question: How I should react towards this?
This answer will only focus on long term strategies that might help you avoid such situations as you move forward. 

To succeed in academia you can't really seem to be shy and certainly not seen to be less of a contributor because of it. No matter how good your ideas are, if they don't get considered then you have very little impact. 

However, that doesn't mean that you can't actually be shy, or introverted. Many successful scientists are very introverted and even some are quite far out on the autism spectrum. Shyness isn't a defect or a flaw, it is just a personal tendency. Introverted people, in fact, often are extremely productive as they gather internal strength from reflection, consideration, and thought. 

But the trick is to learn to act as if you have a different set of preferences than you actually do. You can act like an extrovert naturally would even while remaining an introvert. You play a role in public situations that lets your thoughts and needs get notice in the deliberations and conversations. 

But it is a skill that can be difficult to learn. I know, and I did it. The "face" that I show to the world has evolved over time. I once suffered from an "inability" to speak up when I should have and it cost me extra years in a doctoral program. But after that, I learned how to play the role so that my ideas weren't ignored by those with a bigger mouth. 

In fact, you aren't limited by your shyness unless you let it overcome you. You can look people straight in the eye and explain your ideas to them. You don't need to defer to louder people. 

One person, a friend, who is very prominent in the CS community and is a marvelous public speaker is naturally, and in person, extremely quiet and has some characteristics of autism. But he taught himself to do what needed to be done to have his ideas accepted and to act in public in a way that seems to others to be comfortable, even if it is not. One of his tricks was to join an acting group in which he learned how to "put on" a role and act within that role. 

Some people just freeze when confronted. Other people explode into inappropriate behavior. Both of these need to be avoided. Practice is what you need to overcome them if you tend to do that. Preparation for meetings, with notes on what you might want to say can help. 

Finally, let me note that people reading your several posts here probably don't think of you as a shy person. In your writing, you are able to say what you want to say. Some of that is the anonymity that the site affords. In a sense, you can hide the "real you" behind a certain invented persona. The trick is to learn to do that same thing in person. Invent a persona for yourself and act in the way it suggests, hiding your "real self". Yes, I do the same thing here as Buffy.