We in the West mistakenly refer to the language spoken by the majority of people in China as "Chinese". But in truth, the main language of Mainland China is called Mandarin Chinese.
It's a mistake to think of China as one large homogeneous place with one common language. In fact, while Han Chinese are the majority people, there are officially 56 ethnicities recognized by the People's Republic of China. But the interesting thing is that the number of ethnicities pales in comparison to the number of dialects spoken in China. So language is quite an intricate issue in China and one that takes some understanding.
So What Is Mandarin?
Mandarin is the Western name that was historically given to the Imperial Court officials by the Portuguese. The name referred not only to the people but also the language they spoke. But Mandarin is actually the Beijing dialect of the overall group of languages spoken in many parts of China. The Beijing dialect was used in the Imperial Court and then later adopted as the official language of China.
In Mainland China, Mandarin is referred to as Putonghua (普通话), literally "the common language".
For a truly in-depth discussion about Mandarin Chinese and its history, please refer to our Mandarin Expert and read the article Introduction to Mandarin Chinese".
What About Cantonese?
You've heard of Cantonese, right? It's the language you're hearing if you're watching Chinese martial arts movies coming out of Hong Kong.
Cantonese is actually the language spoken by people in Southern China, Guangdong Province (formerly known as Canton), and Hong Kong. Orally, it is completely different from Mandarin but it shares a common writing system.
So, that martial arts movie you're watching? It will have subtitles using the Chinese character-based writing system so that while folks in Beijing can't understand most of what is said, they can read along.
A footnote on the subject of using Mandarin in Hong Kong: I traveled from Mainland China to Hong Kong for the first time in 2005. At that point, not many salespeople or service staff with whom we interacted could speak Mandarin. These days, with the influx of Mainland tourists, Mandarin is widely spoken by Hong Kong folks. So if you're looking for one language to study, I personally think Mandarin is the one to pick.
Other Chinese Dialects
There are many other major dialects in China. Folks from different cities and provinces can immediately tell who's a local and who isn't just by listening to their accent in Mandarin. Places have their own distinct dialects and even in Shanghai, where locals speak a Wu dialect called Shanghaihua, there are even nuances between the two sides of the Huang Pu River within the same city.
What Does This Mean for the Traveler Trying to Use Mandarin?
Actually, it means a lot. I've studied other "difficult" languages, namely Japanese (it was my major language in university!) and German, and have lived or traveled in those countries extensively and find communication with locals in the local language much easier in China. Why? I liken it to the fact that Japanese and German people and languages are more homogeneous. The variables are small between geographic locations. However, in China, folks are used to trying to understand each other through Mandarin. The Mandarin pronunciations may be a bit different depending on where you come from so there's a level of effort in communication in China that there simply isn't in other places.
This is my conjecture. But I find that trying to communicate in Mandarin a much more enjoyable prospect than you might think. If you're planning to visit China, I recommend studying the language at least for a bit. It will make your visit infinitely more enjoyable.