I believe the answer is simple. Though it doesn't need to be with pretty women, but women we are attracted to (might be different :) ). They tend to get shy because they start to imagining being in a relationship t\with the given women, maybe having an intercourse and/or any other desires. So simply put they are outcome oriented.
Now imagine that all that goes through your mind and take into account all bad experience from the past many men have with women (putting yourself out there and getting rejecting). This way they protect themselves from fear of rejection, which is in the end just a fear. Then they shy away in order not to get hurt (gain).
Mind that women experience the same and not everybody is the same :)