Why do mass terms in QFT couple to gravity? In QFT (or a classical field theory for that matter) mass terms appear as quadratic terms in the Lagrangian. For example for the Klein Gordon equation with metric signature $(+,-,-,-)$ we have
$$\mathcal L=\frac 1 2\partial^\mu\phi\,\partial_\mu\phi-\frac 1 2m^2c^2\phi^2$$
If I understand correctly the reason this is a mass term is that it modifies the dispersion $\omega=c|\mathbf k|$ of the massless equations of motion $\partial^\mu\partial_\mu\phi=0 $ to the dispersion $\omega^2=c^2|\mathbf k|^2+m^2c^4$ in the massive EOM and this modification makes excitations behave like they have mass. Here I put $\hbar=1$.
The fact that quadratic terms give mass is a general principle. In the Higgs mechanism an interaction term with the Higgs field of the form $\frac{e^2v^2}{2}A^\mu A_\mu$ gives mass to the $A_\mu$ field where $v$ is the vacuum expectation value of some other field.
Now my question is that while in QFT mass this mass is a mathematical property on the kinematics of fields in general relavity mass is a really physical property: objects that have mass appear in the stress energy tensor and by doing so they curve spacetime. So how does spacetime know that my field has a quadratic term in its Lagrangian? Are quadratic terms in the Lagrangian always coupled to spacetime? What is mass even?
 A: As a general rule I would be cautious of putting too much stock in the idea that mass is quadratic. For theories that are free, the dispersion relation picks up the right $m^2 c^4$ term as you say. But there are also strongly coupled mechanisms for generating mass that are less transparent, as in the Yang-Mills mass gap.
Second, plenty of things which are not (in modern terminology called) mass also appear in the stress energy tensor and all of these curve spacetime. An example theory where spacetime macroscopically curves due to light is given by the Vaidya metric. So spacetime doesn't just have to know about mass terms in the Lagrangian... it has to know the Lagrangian full stop. This is achieved because gravitating matter systems are obtained by adding
$$
\int \mathcal{L} \color{red}{\sqrt{-g}} \; d^4x
$$
to the Einstein-Hilbert action. Einstein's equation, which is obtained by varying the action with respect to the metric, therefore picks up contributions related to all the terms in $\mathcal{L}$. These ones, quadratic or not, end up in the stress energy tensor on the right hand side.
So that is how gravity is able to couple to everything in QFT except very special topological terms. As for the broadest question of what is mass, there are various directions one could take. But I would recommend reading about the ADM formalism. In particular, this can answer the question of what it means for a black hole to have mass even though the Kerr metric (approximately reached after some presumably more conventional source of mass has "collapsed") is a vacuum solution of GR.
