Imagine two planet-sized bodies in deep space. Placed 'near' to each other (by which I mean not in orbit around each other) they will accelerate towards each other under mutual gravitational attraction, and eventually collide.
To be concrete about this, let's assume that we are placing the objects sufficiently close together that they will collide on a timescale much shorter than that of the Universe's expansion, so that for all intents and purposes the Universe is static. If the bodies have no relative velocities or angular momentum to start, then they will collide.
In the classical sense, 'work' is being done to move them, and thus energy is being expended.
Work is the integral of the (dot) product of a force (here, gravity) and a distance; so work is, indeed, being done here. Be careful about stating that energy is expended, however. If we assume that the system is closed in the sense that heat doesn't escape the pair (a very good assumption up until the bodies actually collide), then the total energy of the system is conserved. I am guessing that by "energy expended", you mean that the bodies lose gravitational potential energy and gain kinetic energy during the infall. There is therefore an "exchange" of energy, if you will, between the potential energy of the system and the net kinetic energy, but energy is not lost.
What is the source of this energy?
In light of the above, the "source" of energy is gravitational potential energy. In fact, you impart this energy to the system by placing the bodies in space at the chosen distance. The situation is analogous to placing two styrofoam balls on either end of a spring, stretching it out, and letting the balls "spring" together. When you stretch out the spring, you are doing work to store potential energy in the spring. When you let go and the balls are pulled together by the spring, the potential energy stored in the spring is in converted into kinetic energy in the attached balls (we ignore any heat dissipated in the spring here). Where did the energy in the moving balls come from? From you, when you did work to place the balls a certain distance apart by stretching the spring. The same is true for gravity in the example you mention: someone (or something) does work to place the balls a distance apart (think about how much work you would do to carry a bowling ball to the top floor of a skyscraper using the stairs; you do indeed do work to separate the bowling ball, object 1, from the Earth, object 2!). The gravitational potential energy in the system is then converted into kinetic energy as the force of gravity pulls the objects towards each other.
This page was last updated June 27, 2015.