Do you insist that the formula be interpreted as the value of a residue, hence requiring that it be known that the zeta-function of every number field is meromorphic around $s = 1$? It goes back to Dedekind that for every $K$ the limit $\lim_{s \rightarrow 1^+} (s-1)\zeta_K(s)$ exists and is given by the standard formula, but this couldn't be interpreted by him as a residue calculation since at that time it wasn't known that $\zeta_K(s)$ could be continued beyond ${\rm Re}(s) > 1$. However, if you're willing to accept the computation of that limit as a poor man's residue, then the formula goes back to Dedekind.

In 1903 Landau proved for every $K$ that $\zeta_K(s)$ can be analytically continued to ${\rm Re}(s) > 1 - 1/[K:\mathbf Q]$ (see the section on the zeta-function of a number field in Lang's Algebraic Number Theory). This was part of his proof of the prime ideal theorem, and it was the first proof for general $K$ that $\zeta_K(s)$ is meromorphic around $s = 1$. By this work Dedekind's calculation could be interpreted as a residue calculation. Therefore if you require the formula arise as a residue then in principle I'd say the result is due to Landau, although I haven't looked at his 1903 paper to see if he is explicit about that.