A psychodynamic theorist would likely assume that a person who is extremely shy is sub consciously avoiding people due to a desire to avoid conflict, commitment, or responsibility. The conscious behavior of being shy allows them to help their subconscious desire to avoid people, and by extension, the complexities of dealing with people.
Shyness is also likely to be a function of the superego, as responsibility based social interaction tends to be the domain of the superego, which governs fitting into societal and "parental" rules.