If you're interested in the proof:
W = Integral F.dx (work done against any force)
Ep is defined as the work done ON the system (i.e. gravity) to move an object mass m from an infinite distance away, to a distance r, from another object mass M. As the object m is drawn towards the object M, dr (which is in the direction of it's motion) is in the same direction as the force.
Ep = Integral {Infinity->r} F.dr
F = GmM/r^2 (Newton's law of gravitation)
Ep = Integral {Infinity->r} GmM/r^2 dr
= GmM Integral {Infinity->r} 1/r^2 dr
= -GmM/r
It makes sense that Ep is negative, since in bringing the mass m from far away to M, the system (graviation) did the work required so the work done BY the system was positive, or equivalently the work done ON the system was negative.