I don’t really feel comfortable drawing a conclusion from the limited information provided, because I think this could go either way. The guy could actually be making inappropriate romantic advances, or he could be just a normal guy making completely appropriate conversation and the OP is overly nervous about strangers or worse, a complete snob looking for affirmation for her rudely excluding another student because he isn’t up to her social caliber in her own mind. It’s really not possible to know which situation we are dealing with.
However, I have a couple thoughts. If the content of this guy’s conversation IS really suggestive, rude, too personal, or otherwise inappropriate (and this isn’t a case of “I’m so embarrassed that someone that nerdy would have the nerve to talk to me! What if someone sees me talking to him? I’ll never get to sit at the cool-people table again!”) then there is nothing wrong with being blunt and saying, “I don’t like the way you are talking to me. I’m not interested in you. Please stop.”
On the other hand, I am of the opinion that a person is obligated to politely interact with others in a social environment. It’s mean and unprofessional to treat one’s classmates or coworkers as if they are an inconvenient infringement on your solitude. If a person requires a certain amount of solitude, they should assign themselves regular private time in a place where it’s reasonable to seek one’s own compan as the OP describedy undisturbed. A classroom where students are gathering for ns
a science class is simply not that place. They should not feel entitled to scowl at, brush off, or be rude to people who have the gall to greet them and ask them how their weekend was. Self-proclaiming oneself to be an introvert does not a valid excuse make, particularly since this behavior can actually be really hurtful to someone who is sensitive.
The OP is the only one who was there so she is the only one who can determine if the guy in her class’ behavior legitimately earns a brushoff or a blunt dismissal, or whether she should just suck it up and let the guy tell her about his stamp collection.