The friendzone is the result of men/boys
- feeling that all the pressure is on them to initiate a relationship (which is usually how it works)
- feeling shy and insecure (some are more naturally confident than others), and
- fearing failure (some men are risk-takers, while others like to play it safe)
The result is that some men are so intimidated by the pressure of beginning a relationship and the risk of a painful failure that they almost have to ease their way into it by getting to know a potential partner first in a platonic way. Their logic goes, if you can't be friends with someone platonically, then how could you consider them as a life partner? For these men, the idea of approaching someone that you don't know and randomly trying to strike up a romantic engagement with them is literally paralyzing. They're looking for more than just attraction at that physical level, because they're considering a long-term relationship. It takes a lot more investment for them to feel an attraction to someone that they wish to actually take a chance at pursuing.
Meanwhile, women typically have the luxury of sitting back and letting men approach them, and strangely enough, the above traits are not really ones that women, most women at least, find attractive in would-be suitors. Also, women's risk-aversion tends to work in the opposite direction: since so many of the men who they run into seem mainly just to be interested in sex, when they do find that they are good platonic friends with someone of the opposite sex, they don't want to risk ruining that friendship.
So the friendzone is basically a perfect storm where you've got a specific type of man who's interested in a specific type of woman, but his attraction develops as he puts quite a lot of time into getting to know them. Both of them may see the relationship as a potentially long-lasting friendship, but the guy feels like that long-lasting friendship is a solid foundation on which they could perhaps build a romantic relationship (which he hopes to last a long time, because the idea of it failing or having to start over is terrifying), while she feels that doing so would possibly ruin everything. As they spend more time together, his romantic attraction toward her increases, while at the same time hers decreases, and by the time the guy realizes that she's not willing to turn that corner, it's a crushing blow because it means that he has to start all over from square zero; he also might feel hurt because he probably assumed that she must feel something similar toward him (which clearly wasn't true at all). And then the woman's impression is often going to be that his friendship wasn't genuine and all along he really just wanted to screw her (which also may not be true at all).
tl;dr: the friendzone happens when men are afraid of building romantic relationships on shaky footing of barely even knowing someone, and women are afraid of building them on solid friendships that may be ruined.