Entropy maximization and energy minimization are equivalent statements of the same thing, as I understand it. If the internal energy is fixed, entropy is maximized because of statiatical reasons. If the entropy is fixed, and the system can exchange energy with its environment, then the system will give energy to its environment to maximize the environments entropy (and hence total entropy).
But I haven't been able to understand why we would assume here that the entropy of a system is fixed. What physical mechanism causes this?