When you think logically about where to draw a line between a dialect and a language, it would seem that the place to draw the line would be at mutual intelligibility. If the way two groups of people speak is mutually intelligible but somewhat different in pronunciation, word usage, etc., you're looking at two dialects, whereas if those two patterns of speech are not mutually intelligible, you're looking at two languages.
This standard would generally work well as a rule of thumb. American, British, and Australian English would all be dialects, as would the Kantou and Kansai dialects of Japanese, while Spanish and Portuguese would be languages. However, such a division won't always hold true in all languages, and the big example I'm thinking of is Chinese.
China is a country full of what I, and apparently most linguists, would call languages. They are all for the most part related Sino-Tibetan languages, but as they are generally mutually unintelligible I'd classify them as languages. Indeed, the English of most of these end in the "-ese" suffix, designating them as languages rather than dialects, e.g., Cantonese, Shanghainese, etc. However, in Chinese they are referred to as fāngyán 方言 ("dialects"). When referring to them directly, Chinese will often use the -huà -话 (roughly, "speak") suffix, which usually designates a dialect, e.g., Guǎngdōnghuà 广东话 ("Cantonese"), Shànghǎihuà 上海话 ("Shanghainese"), etc. Other examples of where this -huà -话 is used to designate a dialect are Pǔtōnghuà ("Mandarin", or literally "normal speak") and Měiguóhuà ("American English", or literally "America speak"). In contrast, the suffixes -yǔ -语 and -wén -文 are generally used to designate languages, e.g., Hànyǔ 汉语 ("Chinese", or literally "the Han language"), Zhōngwén 中文 ("Chinese", or literally "the Chinese language"), Yīngyǔ 英语 and Yīngwén 英文 ("English"), etc.
I often compare Chinese "dialects" to the Romance languages. The differences between Chinese dialects and the Romance languages are similar. The spoken word is generally mutually unintelligible, but you'll be able to pick out at a minimum some words and phrases. They all share a vast vocabulary base, although pronunciations often vary to the point of mutual unintelligibility. Grammar is extremely similar, so if you ever do need to learn another, you'll have little problem doing it. If you know one, you can do a pretty good job of reading another. Indeed, the two words above for Chinese emphasize this fact; -yǔ -语 emphasizes the spoken language, and hence is linked with the Han group and how they in particular speak, while -wén -文 emphasizes the written language, and hence is linked with all of China because of how the written language can largely be understood anywhere in China regardless of the dialect you speak.
So why is one called a dialect and the other a language? Although I'd venture that the gap between the Romance languages might be a bit bigger than the gap between the Chinese dialects, it seems to me that history and politics are at the heart of it. Europe has long been divided into countries, each more or less with its own language, stressing the difference. China, on the other hand, for whom national unity has been a long historical struggle and remains a core policy of the government, prefers to stress the oneness of the Chinese language while downplaying the differences that these dialects actually represent. But, if you consider them dialects, then you can make a pretty strong argument that the Romance languages are dialects of Latin. And if you consider the Romance languages to be languages, then, vice versa, you can argue that the Chinese dialects are mostly separate languages as well.
What does a language learner take home from this? If you speak Mandarin, don't think you're going to nail down Cantonese as easily as you'd go from American English to British English just because it's called a dialect. At the same time, don't think that the differences between Portuguese and Spanish are so great just because they're called separate languages. If you really want to know how far two languages/dialects are apart from each other, talk to some speakers of both languages and take a look at some language family trees, which can be found aplenty on Wikipedia.