'Desu' and 'Masu' are both terms which make a sentence sound more formal in Japanese. They both perform the same function, but cant be used interchangeably. The rule to remember is that 'Desu' is used after nouns or adjectives, whereas 'masu' is only used after verbs.
Let's look at some examples. The sentence "これは猫です" (This is a cat) uses 'desu' because the noun 猫(cat) is the last term in the sentence. Another example is a sentence such as "猫はかわいいです" (Cats are cute). The last term before the formality 'desu' is かわいい(cute). Cute is an adjective, therefore 'desu' must be used in this case. For 'masu', which is only applied to verbs, the verb must be modified in form when attaching the formality afterwards. Terms such as 走る(to run) change to 走ります rather than 走るます, because as a rule the verb cannot be left in its infinitive form.