Clearly, molecules are not in any sense volitional agents. They're simply subject to the basic and immutable laws of thermodynamics, the second of which states that any isolated system always spontaneously develops toward a state of equilibrium in which entropy (which can be informally described as "disorder" or "randomness," meaning thermal energy distributed in such a way that it cannot be used to perform useful work) is maximized. Increased stability is really another term for the minimization of free energy, i.e., energy available to perform useful work. All irreversible spontaneous chemical reactions are ones in which the free energy change is negative, either because the chemical reagents involved experience an increase in entropy, or because the thermal energy released by the reaction sufficiently increases the entropy of the surroundings. The basic, simplified equation for describing this situation is:
$$\ce{\Delta G\ =\ \Delta H\ -\ T\Delta S}$$
Where $\small\ce{\Delta G}$ is the change in free energy, $\small\ce{\Delta H}$ is enthalpy (change in heat energy), $\small\ce{T}$ is absolute temperature, and $\small\ce{\Delta S}$ is the change in entropy. If $\small\ce{\Delta G}$ is negative for a particular reaction at a given temperature, the reaction will proceed spontaneously. In essence, the entire universe is evolving toward a state in which entropy is maximized and free energy is minimized, and only chemical reactions which contribute to that phenomenon can spontaneously take place.