If asked to give the units of some complicated quantity in more basic units, try to think of a physical equation you know that relates the complicated quantity (i.e. energy, units J) to other quantities. In this case, you might know that work done equals force times distance, i.e.
W = F x d
In units:
J = N x m
We're almost there. We now have to express the unit Newton in kg, m and s. Fortunately, we know Newton's second law:
F = m x a
Which gives us the basic units of N:
N = kg x m s^-2
Thus the overall units of energy are:
J = kg m^2 s^-2
A bit of physics trivia: relating different kinds of units is not just a boring exercise - dimensional analysis lead Geoffrey Taylor to find out the energy of an atomic bomb blast by looking at some time stamped pictures of the explosion! (This somewhat displeased the US government, who didn't realise that these pictures would give away their military secret)