The internal energy of a closed system is $dU=TdS-PdV $. In an isolated system $dU=0, dV=0$ which would imply that $dS=0$, However, the entropy can increase due to chemical reaction or diffusion mixing different substances which were initially separate. Similarly $dG=-SdT+VdP$ and if $T$ and $P$ are held constant this does not mean that $G$ cannot change as this is an extensive quantity and thus depends on the amount of material. For example in a galvanic cell more useful work can be done if more material is present, e.g. adding copper sulphate to a Daniel cell, so that $G$ must increase. This means that in a chemical system work can be done, i.e. lifting a weight etc., without there being any change in volume between the initial and final states, i.e. work done other than $PV$ work.
The difficulties with $dU=TdS-PdV $ and $dG=-SdT+VdP$ are due to the fact that we ignore the amount of material present. This changes the energy by an amount $\sum_i \mu_idn_i$ where $\mu$ is the chemical potential. It is called this by analogy to gravitational and electrical potential. In a gravitational field a mass $m$ has energy $mgh$ where $gh$ is the potential and $m$ the quantity. A charge $q$ has energy $q\varphi$ where $\varphi$ is the potential and $q$ the quantity. In chemical energy, $dn$ is the quantity and $\mu$ the potential so the energy is $\mu dn$ for each species.
In a homogeneous phase containing several different substances with $n_1,n_2..$ moles of species $1,2...$ the total differential of $U$ in terms of $S, T$ and $n_1,n-2..$ is
$$\displaystyle dU=TdS-PdV +\sum\mu_idn_i,\qquad \mu_i \equiv \left(\frac{\partial U}{\partial n_i} \right)_{S,V,n_j}$$
where subscript $j$ indicates all other species except $i$ are constant. Similarly for the Gibbs energy
$$\displaystyle dG=-SdT+VdP+\sum\mu_idn_i,\qquad \mu_i \equiv \left(\frac{\partial G}{\partial n_i} \right)_{T,P,n_j}$$
and this last definition provides the chemical potential shorthand label as the Gibbs energy /mole or more properly the gradient of the Gibbs energy/mole for a given species.
With reversible change in a closed system using $dU=TdS-PdV +\sum\mu_idn_i$ the heat absorbed by the system is $TdS$, thus the remaining terms represent the total work done. Thus $\sum\mu_idn_i$ is a form of work/energy in the absence of a change in volume.
The fugacity is used as a proxy for pressure for example when an imperfect gas is studied. It is defined as $\mu = \mu^\text{o} +RT\ln(f),\quad f/P\to 1 ; P\to 0$ so that fugacity equals the pressure when the ideal gas law is obeyed.