What does it mean when you catch a guy staring at you and then quickly looks away?
There have been a few good replies here - - mostly guesses, and a few rude comments.
When you ask, "what does it mean," you are delving into the "why." Why is he doing what he is doing? There are three parts to this question.
First, is he actually looking at you to begin with, or is he looking at someone or something near you or beyond you? How many times has this happened? Where are you when it occurs? If it is the same setting each time (a classroom, workplace, public transportation, etc.), could there be something else that he is consistently looking at other than you (a teacher, another student, co-worker, boss, a poster on the wall behind you, etc.)? Sometimes, people daydream, and their stare is beyond anything or anyone in the room. Their vision becomes blurred and their mind is wondering miles away. When they realize someone in the room is staring back at them, they snap out of the daydream, and look away. It must first be determined if he is actually looking at you.
The second part of the why question is, "why is he looking at you?" If he is, in fact, intentionally looking at you - - then why? There are many possibilities, as some here have suggested. Perhaps he likes you, and is too shy to approach. Perhaps he thinks you are attractive, and enjoys looking at you. Maybe you look like someone else or looks familiar to him, and he is trying to figure out where he knows you. Maybe he likes your outfit, or the way you style your hair, and is mesmerized by it. Do you have something written on a t-shirt, that he is reading? To cover all bases, there is the possibility that he finds something unattractive about you, and can't resist staring at you for that reason. He is the only one who knows why he is looking at you in the first place, so all anyone here (myself included) can do is guess. I would guess that he likes you, or thinks you are attractive and pleasant to look at. He might be fantasizing over meeting you, talking to you, kissing you, or more, but only he knows that for sure.
The third part is, "why does he looking away when you look at him?" This seems rather obvious, but the likely reason is that he does not want you to know that he is looking at you. If he was just staring off into the distance (daydreaming), he might look away so as not to make you think he was looking directly at you intentionally. If he was looking at you and got caught, then he might not have the confidence enough to smile and say "hi" once you two make eye contact. Some people are just not comfortable with "mutual" eye contact. They don't mind looking at someone, but as soon as the eyes meet, they know they are being looked back at, and this makes them uncomfortable or brings out their insecurities. Looking away simply indicates that he most likely does not know what to do to move past just looking at you.
Since there are too many variables and options as to the "why," I think it would be best if you simply introduced yourself to him. Rather than abruptly confronting him about him looking at you, strike up a casual conversation and find out if he likes you. If you like him, and would consider developing a friendship, or possible relationship, then you can let him know that you are also interested in him. If you are not interested in him, then you could politely let him know that too. If he keeps looking at you, then let him know that you are uncomfortable with that as well.
Usually, open and honest, polite communication is the best policy, and getting things out in the open helps people to move past the initial awkward stage of first meetings and introductions, and then they can decide where they want to go from there.
Good luck, and please post back in the comments under your question of any developments. "Here's looking at you, kid." (reference to Humphrey Bogart & Ingrid Bergman in Casablanca).