It is true that 'on' and 'nous' both mean 'we' and can be used pretty much interchangeably but there are subtleties to be aware of when using them. Although you can use both, they are used in different registers (levels of formality). This means that you are more likely to see 'nous' in more formal or professional speech, and more likely to see 'on' in casual speech amongst friends or family. As an example, you would be more likely to hear someone say to a mechanic 'Nous sommes tombés en panne sur l'autoroute.' (We broke down on the motorway.) But you would be more likely to hear 'Maman, on a faim. Il reste des chips ?' (Mum, we're hungry. Are there any crisps left?). So, although you can use both to mean 'we', there are slight differences in the situation they are used in. You can also see that 'on', although sometimes meaning 'we', always uses the third person singular (he, she, it) endings of verbs.
Also, there are a few things to be aware of when using 'on' to mean 'we'. Firstly 'on' has another meaning, which is 'you' in a general sense or 'one'. So when saying general statements that don't apply to anyone in particular, where in English you might say 'you' or much more formally 'one', you would use 'on' in French. For example, 'You/One can never have too many t-shirts.' would be translated as 'On ne peut jamais avoir trop de t-shirts.' and not 'Tu ne peux jamais avoir trop de t-shirts.' It's important to recognise that in this sense, 'on' does not mean 'we'. Secondly, when using 'on', it's also important to know that 'on' can only replace 'nous' as a subject, it does not mean 'us' or 'ourselves'. So when using verbs which have two pronouns as their subject (reflexive verbs and pronominal verbs), such as 'se brosser les dents' (to brush one's teeth), the two options to translate 'we brush our teeth' are 'nous nous brossons les dents' and 'on nous brosse les dents', and you cannot say 'on on brosse les dents'.