First of all, you have to understand something about Chinese languages. In China there are several languages and I think you know at least Mandarin and Catonese. But there are more. There's Wu, Xiang, Hakka, Min etc.
However, all Chinese usually know their own dialect (e.g. Hakka) and learn the standard language (Mandarin) as well. The characters look the same though, so it might be tough to teach them the correct pronunciation. In order to overcome this difficulty the Chinese use pinyin in order to teach the correct pronunciation.
To illustrate why I will show you "Hello" in Mandarin and Cantonese:
你好 (Mandarin) - ni3 hao3 (1 is a high flat tone, 2 is a rising tone, 3 is a falling and then rising tone and 4 is a falling tone. 0 is 'toneless')
你好 (Cantonese) - nei5 ho2
So in order for Cantonese people to understand how they have to pronounce 你好 in Mandarin, they need to know the pinyin.
Pinyin can be used to input Mandarin on your computer as well. You just type ni3 hao3 or ni hao and it will convert the pinyin to the respective characters. Sometimes you instantly get the right characters, but sometimes you have to select them from a list. After a while it will feel pretty natural though. There are some other ways to input characters by typing the strokes or by actually drawing them with a tablet (or mouse if you don't care about RSI).
Hope this helps. Good luck!