Consider a string that has neither A nor B: it got counted once in the original $5^n$, and it was subtracted twice, once because it has no A, and once again because it has no B. Thus, the calculation $5^n-3\cdot4^n$ counts it a net total of $-1$ times. You want to count it $0$ times, so you need to add it back in. How many such strings are there? Clearly these are $3^n$ of them, so we need to add $3^n$. The same argument applies to the strings that are missing both A and C, and to the strings that are missing both B and C, so actually have to add back in $3\cdot3^n$: one $3^n$ for the strings missing A and B, another for those missing A and C, and a third for those missing B and C.
At this point our provisional result is $5^n-3\cdot4^n+3\cdot3^n$. However, there are $2^n$ strings that are missing A, B, and C, and we should check whether they’re being counted correctly. Each of them is counted once in $5^n$; subtracted $3$ times in the $-3\cdot4^n$ term, once for missing A, once for missing B, and once for missing C; and added back in $3$ times in the $3\cdot3^n$ term, once for missing A and B, once for missing A and C, and once for missing B and C. Thus, each of these strings has been counted a net total of $1-3+3=1$ time, when we want it to be counted just once. Clearly we should subtract $2^n$ to fix this, giving us
$$5^n-3\cdot4^n+3\cdot3^n+2^n$$
strings with at least one each of A, B, and C.
The inclusion-exclusion principle actually has a much more general form, and its proof requires a little mathematical sophistication, but the underlying idea in its simplest form is what I’ve tried to explain here: the alternating terms correct for successive over- and undercounting of the set in which we’re interested.