It is true for all functions $f(x,y)$ that are once-differentiable with respect to $x$, and such that $f(x,y)$ and $\partial f(x,y)/\partial y$ are integrable with respect to $y$.
Very roughly, differentiation and integration wrt different variables commute for the same reason that differentation and summation commute:
$\frac{\partial}{\partial x} \sum_y f(x,y) = \sum_y \frac{\partial}{\partial x} f(x,y)$
i.e. because differentiation is a linear operation. There are some technicalities to do with passing of limits through integral signs (to turn the sum into an integral) but the intuition is in realising that integration and summation are basically the same thing.
Also note that in your expression, the function on the left-hand side is a function of $x$ only, so your partial derivative might be more correctly expressed as a total derivative (the same comment applies to the equation in this answer - I've left it in this form to make the relationship with your equation clearer).