$\def\sO{\mathcal{O}} \def\frm{\mathfrak{m}} $If $(R,\frm)$ is a local ring, the field $R/\frm$ is called the residue field of $R$. More generally, let $(X,\sO_X)$ be a locally ringed space. The residue field of $X$ at $x$, denoted $\kappa(x)$, is the residue field of the local ring $\sO_{X,x}$. My question is: why is it called like that?
I guess this question may be answered in two possible directions:
Who came up with the name in the first place? Do we know their reasons for this choice of terminology?
What is a possible motivation that justifies why this name is a good fit for the idea behind the residue field?
In the particular cases where the locally ringed space $(X,\sO_X)$ is a smooth manifold, a complex manifold or a $k$-prevariety along with the corresponding structure sheaf of functions that are, respectively, real-valued smooth, complex-valued holomorphic, or $k$-valued regular, the homomorphisms $\sO_{X,x}\to\kappa(x)$ and $\sO(U)\to\kappa(x)$ (with $U\subset X$ an open neighborhood of $x$) are exactly evaluation at $x$. In this situation, I don't see what exactly the "residue" is. Neither I do in the case when $(X,\sO_X)$ is a variety (in the sense of schemes). The only residue field I know how to interpret in this case is the one at the generic point: It is the function field of the variety, but again I don't know what does this have to do with residues.