If we are here talking about an exited system like an exited atom, uantum mechanics rather than classical mechanics needs to be applied. If we are talkning about a macroscopic system, i.e. a ball at the top of a hill, work is done when the ball rolls down towards the bottom of the hill. that work is done by gravity.
In particular, having an excited system it means that it exists a state lower in energy and more stable. Furthermore, there is an energy difference between the two states {Delta}_E>0. Because of the Heisenberg's Uncertainty principle, in particular referred to the uncertainty Time - Energy, the product between the respective uncertainties of Energy {Delta}'_E (where this one is not the energy distance between ground and excited state, but the uncertainty on the Energy level) and Time {Delta}_t has to be greater or equal to h, Planck's constant. So, since, independently by your system, an excited state has a finite uncertainty, even the life time of that state has a finite duration, inversely proportional to {Delta}'_E, and the system decays spontaneously to ground state.
Exact calculations of quantum energy levels shows, that they are unstable except bottom one (called vacuum state). Time instability is like exp(-t/tau) and it lead any initial state to vacuum one.
As already mentioned by Ronny, when moving an object in a potential field from lower potential to higher, we have to invest work for overcoming the force which acts in the opposite direction - i.e. from higher potential to lower. But if we let the object alone, the force of the field does work, making the object fall from higher to lower potential. Now, if on the lower level the fall stops, the kinetic energy acquired from the difference in potential energy, transforms into other forms of energy, for instance electromagnetic.
This is the situation in an excited atom too, when moving from an excited level to the ground one. The electrostatic force does work. Now, on the ground level not only the potential energy is lower than on the excited level, but also the kinetic energy is lower. So, the difference in potential energy is not taken by an increased kinetic energy. As in the case of the object falling from the hill, the difference in total energy transforms into another form of energy - which in the case of the atom is a photon.
ADDITIONAL INFORMATION: The object on the hill, as well as the atom in the excited state, are said to be in unstable equilibrium. That means, a small perturbation makes them to fall on a more stable state. For the object on the hill, a blow of wind would make it roll down. For the electron in the excited state, the theory of decay explains that there is a coupling between the movement in this state, and other types of movement, typical to the environment. This coupling is the perturbation that makes the decay possible.
It's simple to explain this also by resorting to only classical physics (I propose a macroscopic example of what occurs at a molecular level).
Let's imagine of shooting a ball into a large container of balls.
Its kinetic energy is transferred to the other balls. Of course. As if the energy were diluted.
Thus, a system reaches equilibrium spontaneously whenever it is in communication with something else that can receive energy. It's a matter of homeostasis and the main factor in this issue is kinetic energy.
There are however other factors at quantum level which can determine an advance toward balance. I think for instance of a radioactive element which decays. But also in this case there's communication with something else (quantum vacuum) since a perfectly isolated system would maintain its state.
Why was this question downvoted? Is there somebody who believes that we know everything? That we don't have doubts? That we don't put sometimes under question mark even simple principles of the physics?
If somebody felt displeased with this question, he/she should better have asked the poster of it, what made him ask this, what is the doubt behind this question.
People should show some maturity when distributing votes.