It's known that all objects with a certain amount of mass generate gravity. This is because of Einstein's relitivity theory. Look at it like this:
Get at towel or a blanket and stretch it on all four sides. Now put a poolball on the blanket. What you see is that the blanket is bent.
If you put a smaller ball on the blanket you will see that the smaller ball will roll over to the heavier poolball because the blanket is more bent at the poolball's side.
The same thing happens in space. All objects, with mass, bend space (and time). So the more mass the object has, the more gravity it will have.
On earth we consider to have 1G, if the earth had 2x the mass it has now it would be 2G of gravity.
When two bodies attract eachother, think about the blanket. Space is bent around both bodies and they just "roll" inside eachother's bent area.