Actually not everything wants to have smallest energy. It rather wants to have the smallest free energy, which can be one of the 4 potentials inhttp://en.wikipedia.org/wiki/Thermodynamic_free_energy
Which one exactly depends on the system constraints.
One can derive from the second law of thermodynamics, that a thermodynamic potential has to be minimized!
So you'd need to read about thermodynamics potentials and even more importantly the so called "availability".

To learn why the mass seems to increase you'd have to study special relativity. Well, the rest mass does not increase. So in fact forget that there is any mass apart from the rest mass (which is constant). The other thing is only energy. It is an outdated view that there is something called mass which increases with velocity.