Is Academia really just a huge competition? I am currently an undergraduate student. I noticed that regardless of what courses I'm taking, there are always a handful of people who view everything as a huge competition. That is, they would do anything possible (other than committing academic offenses) to ensure that the final grade they receive is higher than everyone else's. They create a rather hostile environment.

However, I always thought that Academia is about advancing knowledge, which means we need to help each other, not put each other down.

I am still young, but I have been thinking of pursue an academic career. So my question is, are there any reasons for this competitive behaviour? Is this just an undergraduate problem that will go away when I enter graduate school? Or am I just way too naive of how the world really works?
You've asked a question that is both very important and very difficult, as well as one that is likely to draw different answers from different people depending on their own experiences in academia.

This is because there are both competitive and cooperative aspects to academia.  Different people take different strategies with respect to the balance between these two, and that affects their communities as well, so that the mixture of competition and cooperation that you encounter will also radically differ between different academic communities.

Some of the key factors for inducing cooperation are:


Science is hard.
Working together, people can accomplish things that they cannot possibly accomplish alone.
Cooperation in a team gives you an advantage when competing with other teams.
Many people enjoy working together in teams, and this is just as true for science as it is for any other human endeavor.
Scientific discovery feels awesome and it can be really fun to share that feeling with other people.


Some of the key factors for inducing competition are:


Inherent conflict of ideas: when theories compete, people often become polarized and begin competing based on the "team" they support intellectually.
Limited resources: you've got a good idea, but a lot of other people have good ideas too, and there is not enough funding to support all of them fully: some people will not get what they want.  Likewise, the Hubble space telescope can only point at one thing at a time, and there are a lot more things people want to point at than time to point at them.
Explicit competition set up by external agencies. For example, DARPA will sometimes make scientists in the same program compete with one another, and the loser gets their funding cut off.
Many people are just plain competitive, and want to "win" over other people in various different ways, and this is just as true for science as it is for any other human endeavor.


Bottom line: just like everything else, academia can be a competition, and everyone faces some aspects of a competition.  But it's not just a competition, and I feel sad for anyone who experiences it in that manner.