There are two ways to understand this equation.  

One is to realise that (reversible ideal case)$\Delta G=W_{\text{non-expansion}}$. Therefore, in an ideal chemical cell, if the potential difference between the electrodes is $E$, to move one mole electrons across the external circuit will be $FE$, which must be equal to the decrease in gibbs free energy of the system. Hence for $n$ mole electrons tranferred at the same potential, $W_{\text{non-expansion}}=\Delta G=-nFE$. 

The fact that $\Delta G=-W_{\text{non-expansion}}$ can be derived as under:-
$$dU=\delta q+W_{\text{non-expansion}}+W_{\text{expansion}}$$
$$ds ={ \delta q/t}$$(in reversible case)
$$Tds=dU-W_{\text{non-expansion}}-W_{\text{expansion}}$$
$$W_{\text{non-expansion}}=dU+pdV-Tds$$(for constant pressure and temperature)
$$W_{\text{non-expansion}}=dH-Tds=dG$$

Another approach is to use $\mu_{electrochemical}=\mu_{chemical}+zF\phi$ where $\phi$=electric potential at the point, $z$ is the charge on the species. using this and 
$$dG_{T,P}=\sum_{i=1}^n \mu_idn_i$$
we get the required equation for $z=1$ for an electron, and considering the electrochemical potential of both the electrodes. I am unsure of a rigorous derivation for the electrochemical potential but this is some basics on it.

Derivation of relationship between Gibbs free energy and electrochemical cell potential
A pointed category is a (small) category together with a distinguished object, called the basepoint $*$. How does one explicitly construct the coproduct of two pointed categories? 

This problem reduces to constructing the coproduct of two pointed connected categories. If both categories have one object, this becomes the free product of monoids.
