Simple way to get the identity
IMHO the matter has nothing to do with the behavior of $\phi$ at infinity. It has to do with a simple property of the path integral, namely, that the path integral of a functional derivative is zero (I shall explain it in a second).
To explain how it is employed, recall that functional derivatives obey the product rule. Therefore we have $$\dfrac{\delta}{\delta \phi(z)}\bigg[\hat{Z}[\phi]\exp\left(i \int d^dx \ J(x)\phi(x)\right)\bigg]=\dfrac{\delta\hat{Z}[\phi]}{\delta \phi(z)}\exp\left(i\int d^dx \ J(x)\phi(x)\right)+\\+\hat{Z}[\phi] iJ(z)\exp\left(i\int d^dx \ J(x)\phi(x)\right)\tag{1}.$$
Multiplying by $i$ and functionally integrating against $\mathfrak{D}\phi$ and employing the property I have claimed the LHS functionally integrates to zero. Therefore we obtain the identity $$i \int \mathfrak{D}\phi \dfrac{\delta\hat{Z}[\phi]}{\delta \phi(z)}\exp\left(i\int d^dx J(x)\phi(x)\right)=\int \mathfrak{D}\phi \hat{Z}[\phi]J(z)\exp\left(i \int d^d x \ J(x)\phi(x)\right)\tag{2}.$$
This is the equation in the OP with the first term already discarded since it corresponds to the functional integral of the functional derivative which I have just said that vanishes. Moreover we have been more careful to denote the free variable as $z$ instead of $x$ to avoid confusion with the integration variable in the exponent.
At first sight this would seem to be a result of assuming some sort of Stokes theorem holds here allowing the conversion of functional integrals of functional derivatives into boundary terms in function space together with the assumption that such boundary terms vanish. This is what I think the notation $\phi\to \infty$ means here: a term in the "boundary of function space".
Particularly I don't buy this argument (and honestly have no idea how to describe the boundary of function space in useful terms). Therefore I have a much simpler one to offer to explain this identity.
Functional integral of a functional derivative is zero
There is a simple argument for this if we assume translation invariance of the path integral measure $\mathfrak{D}\phi$ (which Physicists do assume all the time anyway). In the end of the day the claim is that if $F[\phi]$ is an arbitrary functional of $\phi$ which is functionally differentiable then $$\int \mathfrak{D}\phi \dfrac{\delta F[\phi]}{\delta \phi(z)}=0.\tag{1}$$
To understand this consider one infintiesimal variation $\delta \phi$ of the field configuration $\phi$ and evaluate the change in $F$:
$$\delta F[\phi]:=F[\phi+\delta\phi]-F[\phi]\tag{2}.$$
Now functionally integrate (2). Assuming linearity of the functional integral you'll have two functional integrals. In the first we change varaibles defining $\phi+\delta \phi = \phi'$. Assuming translation invariance of $\mathfrak{D}\phi$ we have $\mathfrak{D}\phi'=\mathfrak{D}\phi$ and therefore we have $$\int \mathfrak{D}\phi \delta F[\phi]=\int \mathfrak{D}\phi F[\phi+\delta \phi]-\int\mathfrak{D}\phi F[\phi]=\int \mathfrak{D}\phi' F[\phi']-\int \mathfrak{D}\phi F[\phi] = 0.\tag{3}$$
Therefore the functional integral of $\delta F$ is always zero. Now expand $\delta F$ in a functional Taylor series: $$\int \mathfrak{D}\phi \delta F[\phi] = \int \mathfrak{D}\phi \left[\int d^dz \dfrac{\delta F[\phi]}{\delta \phi(z)}\delta \phi(z)+\dfrac{1}{2!}\int d^dz_1 d^dz_2\dfrac{\delta^2 F[\phi]}{\delta \phi(z_1)\delta \phi(z_2)}\delta \phi(z_1)\delta \phi(z_2)+\cdots\right]\tag{4}$$
this thing must be zero. Therefore we equate it to zero term by term. The first term gives $$\int \mathfrak{D}\phi\int d^dz \dfrac{\delta F[\phi]}{\delta \phi(z)}\delta\phi(z)=0.\tag{5}$$
Finally assuming that we can interchange the path integral and the spacetime integral yields the equation $$\int d^dz \left(\int \mathfrak{D}\phi \dfrac{\delta F[\phi]}{\delta \phi(z)}\right)\delta \phi(z) =0. \tag{6}$$
Since the variation $\delta \phi(z)$ is arbitrary, equation (6) tells us that in the distributional sense equation (1) must hold.
This derivation of (1) is formal as many manipulations in Physics with path integrals but notice that the central assumption is translation invariance of $\mathfrak{D}\phi$ which is a standard assumption in Physics anyway. In the end, no need to talk about any boundary of function space nor any functional Stokes' theorem (which IMHO would also be formal and even more formal than this approach).