The only determining factor for spontaneity of a process is the total change in entropy of the universe. This must be non-negative.
For a general process within a system, we can decompose this into:
$$\Delta S_{\mathrm{univ}} = \Delta S_{\mathrm{sys}}+\Delta S_{\mathrm{surr}} \geq 0$$
The computation of the system's change in entropy $\Delta S_{\mathrm{sys}}$ is not trivial, but doable. On the other hand, there is no practical way to directly measure or compute the corresponding change for the surroundings. We generally take shortcuts by measuring something else and deriving this value.
For example, for a isothermal, isobaric process, we assume that
$$\Delta S_{\mathrm{surr}} = -\frac{\Delta H_{\mathrm{sys}}}{T}$$
Substitution into the first equation gives:
$$\Delta S_{\mathrm{univ}} = \Delta S_{\mathrm{sys}} -\frac{\Delta H_{\mathrm{sys}}}{T} \geq 0$$
$$-T\Delta S_{\mathrm{sys}} + \Delta H_{\mathrm{sys}} \leq 0$$
This value is $\Delta G$.
For a constant volume process, you use the Helmholz free energy $\Delta F$ instead and just use internal energy change $\Delta U$ instead of $\Delta H$.
From this perspective, free energy is a convenient way to capture the total entropy change of the universe while only considering your system, but not surprisingly, there are assumptions you make in order for the magic to happen.