You're bringing up a thorny topic, friendship at work. If somebody asks you why you're shy, that makes me suspicious. "Friendly" people are liable to pry about your personal problems and very soon, information about these problems can be the subject of gossip.
The most popular self-help book ever written, How to Win Friends and Influence People, says that shy people have an advantage. Good listeners are always welcome.
If somebody asked me why I'm so shy, I could follow Carnegie's advice and focus my attention on the one asking the question, ask how that person is so good at getting along with people. I wouldn't answer the question. I'd find a way to go around it or say that it's things of a very personal nature that I'd rather not talk about. And I would keep the conversation about the other person.
"The most beautiful word the person can hear is the person's own name."
Carnegie's book is available as an audiobook on YouTube. The author's daughter, Donna Carnegie, wrote a version of her father's classic "For Teen Girls" that you might find interesting.
You don't have to be the life of the party to be friendly. In fact, trying to be the life of the party tends to put people off. Carnegie points out that becoming interested n other people makes making friends much, much easier than trying to make people interested in you,
As they say, bullies are cowards. Cowards are afraid to pick on people who get along with a lot of people. All you have to do is get along with a lot of people. Not be close friends with everybody, just get along in a friendly way,
Another author with good advice for dealing with difficult people is the ancient philosopher Marcus Aurelius. He wrote,
"Begin the morning by saying to yourself, I will meet with the busy-body, the ungrateful, arrogant, deceitful, envious. All these things happen by reason of their ignorance of what is good and evil. But I who have seen the nature of the good that it is beautiful, and of the bad that it is ugly, and the nature of him who does wrong, that it is akin to me, not of the same blood or seed, but that it participates in the same intelligence and the same portion of the divinity, I can neither be injured by any of them, for no one can fix on me what is ugly, nor can I be angry with my kinsman, nor hate him, for we are made for cooperation."
I've written a lot of mental health answers, with advice from experts about various topics, including social anxiety, and you're welcome to click on my name and read.
About self-esteem, something that seems very interesting is the relationship between self-esteem and self-effecacy. There are some good YouTube videos that explain this.