METHOD 1
Suppose we were to start off with pure reactants in stoichiometric proportions in the standard state of 1 bar, and end up with pure products in corresponding proportions in the standard state of 1 bar. The change in Gibbs free energy for this process is $\Delta G^0$, as you have answered in your comment to me. To bring about this change, we use whatever equipment is necessary, typically using a van't Hoff equilibrium box and constant temperature compressions and expansions in cylinders with piston. If we had assumed different values of the product and reactant pressures in the initial and final states than 1 bar, then the change in free energy would not be $\Delta G^0$, but rather $\Delta G$, with $$\Delta G=\Delta G^0+RT\ln{Q}$$. If the values of the pressures in this final state happened to be the same as the partial pressures of the reactants and products in an equilibrium reaction mixture, the $\Delta G$ would be 0, and the Q would be equal to the equilibrium constant K. So we would have $$0=\Delta G^0+RT\ln{K} $$
METHOD 2
Here, we start out with a mixture of various amounts of reactants and products that are not at equilibrium, and we analyze the variation in the free energy of the mixture as the reaction proceeds. So, let $n_A$, etc. represent the number of moles of reactants and products at any time as the reaction proceeds, let $G^0_A$ etc. represent the free energies of formation of the reactants and products, and let $p_A$ etc. represent the partial pressures of the reactants and products at any time as the reaction proceeds. So at any time, the Gibbs free energy of the reaction mixture will be:
$$G=n_A(G^0_A+RT\ln{p_A})+n_B(G^0_B+RT\ln{p_B})+n_C(G^0_C+RT\ln{p_C}+n_D(G^0_D+RT\ln{p_D})$$ with $p_A=\frac{n_A}{n_A+n_B+n_C+n_D}P$ , etc., and $n_A=n_{Ao}-a\xi$, $n_B=n_{Bo}-b\xi$, $n_C=n_{Co}+c\xi$, $n_C=n_{Do}+d\xi$, with $\xi$ representing the extent of the reaction and P representing the total pressure.
If we use this equation to make a plot of G vs $\xi$, the equilibrium of the mixture will be determined when G passes through a minimum. If we differentiate this equation with respect to $\xi$ and set the derivative equal to zero, we find algebraically that this happens when $$RT\ln{\left(\frac{p_A^cp_B^d}{p_Ap_B}\right)}=RT\ln{K}=-\Delta G^0$$Work it out yourself and see.
So both very different methods give the same result for the final equilibrium.