If the function $f$ is Borel-measurable and $m$ is a probability measure on $R^n$ such that $$\iint_{R^n\times R^n}f(x,y)^2 m(dx)m(dy)<\infty, $$$$\iint_{R^n\times R^n}f(x,y)^2 m(dx)m(dy)<\infty, \tag{1} $$ then your desired (spectral) sum-of-products decomposition of $f$ exists, where the convergence of the series is in $L^2(R^n\times R^n,m\otimes m)$.
It is easy to see that condition (1) is, not only sufficient, but also necessary for the existence of such a decomposition.