Shy is just a personality trait. In some I suppose it could be exacerbated by a tough upbringing - like if a parent is always hyper-critical, it could make a child feel a lack of self-confidence that would make them hold back even more or feel very self-conscious about talking with other people for fear of judgment. Mostly though it is a personality trait.
As a child I was horribly shy and introverted - it was painful to talk to strangers. As I grew up, I adapted and learned skills that allowed me to do better socially. I also became more self-confidence and that also helped, but I am still an introvert and always will be. It is how I am wired. There's nothing wrong with that at all. It provides balance. We need introverts and extroverts both in the world for many good reasons :)