"da" and "desu" are special verbs that stem from "de aru" and its polite form "de arimasu," which are still occasionally used (and whose forms are still apparent in conjugations of "da" and "desu").
There is a debate on whether to call these verbs the copulas or not. In the end, they do fulfill the role of copulas, but I will also be presenting information theorized in an essay by Michio Tsutsui (the man who wrote the "Dictionary of ___ Japanese Grammar" books), which will help to better explain when to use them when they are not acting as a copula.
A copula is a structure in a language that essentially translates as "to be," to describe a state. However, keep in mind that in English, "to be" is not always the copula, so you should not always translate it into "da" or "desu" in Japanese. Keep the following in mind:
However, even knowing what their role is doesn't always explain when you can use "da," "desu," both, or neither. Thus, Tsutsui's theory:
Tsutsui suggests that the role of "da" and "desu" is to serve as a contextual marker to provide aspect (completed or not) and politeness (plain or polite) when it cannot be provided by conjugating a verb or i-adjective.
He forms the following guidelines:
Regardless of the technical details, below are the conjugations for these two verbs; hover for examples. Although the conjugations themselves are irregular and are not necessarily directly related to the root verb (some stem from the formal form "de aru"), they carry the same basic meaning. Also note that "ja" is a common colloquialism of "dewa."
Seeing as how "desu" conjugations are based on contractions of "de arimasu," you can see how their conjugations are very similar. Unlike "desu," "masu" never serves as a copula—in fact, it cannot be on its own—but it does act like "desu" in that it provides a context of politeness that can only be used with verbs. It is always paired with the continuative form (i-form) of the other verb.