As per the question only moving objects have energy.
The statement given here is not always true.
we know that every moving object has kinetic energy.But in the universe there are other kinds of energy also.
We may take a simple example of potential energy which is the energy possessed by a body due to its configuration and position.
A stone present on the top of a mountain has zero kinetic energy but here the total mechanical energy is in the form of potential energy.
The electrostatic potential energy is not due to the motion of objects also.
There are also various other kinds of energy existing in the nature which are not due to the motion of objects.