Where does gravity get its energy from?
According to the conservation of energy, we cannot create or destroy energy, we can only transform it from one form to the other.
So this justifies that gravity doesn't have an infinite source of energy which never runs out! So it must be getting this energy from somewhere else, right?
Let's take the example of a ball dropped from some height. Gravity of the earth pulls it downward, doing work on the ball and giving it kinetic energy. The question you ask is where did it get this energy from?
Go back a step and think about how this ball ended up at such a height? You lifted it up with your arms, and put it on that height. Your arms did work against gravity, spent some energy to put that ball on that height. Where did that spent energy go? This was given to gravity!
When you do work against gravity, you store energy in the gravitational field as gravitational potential energy, which then gravity uses to do work on that object.
In case of hydro power-plants, the sun is giving energy to the water at sea level, to evaporate and rise(in effect doing work against gravity), which ultimately ends up in dams at a higher height, and then falls converting that initial solar energy to electricity!
Lets make one thing clear. The phrase "gravity gets its energy" is technically not accurate as "gravity" is a type of interaction or force that exist between any two bodies having mass.
You may be wondering why objects move in gravity, where do they get energy from? If I have understood essence of your question.
Well, every object has its own gravitational field, which has infinite range. To make things simpler to understand, lets imagine a region of space where there are only two bodies. These bodies are in gravitational field of each other and hence possess some energy by the virtue of their relative position. We call it potential energy, as the form of energy they possess has a potential to do some work.
Both these bodies will move towards each other due to gravity and their gravitational potential energy will be converted to kinetic energy. Hence, the energy that objects get while moving in gravitational field gets converted at the expense of their gravitational potential energy.
Lets say we have two objects with equal mass close to each other. So gravity does its job and it pulls each other closer, this gets turned into kinetic energy. This is where I'm lost. According to the law of conservation energy can't be created or destroyed and the kinetic energy comes from the gravitational pull so where does the gravitational pull gets its energy.
In Newtonian gravity there exists a potential energy m1m2/r between two bodies , that is where the energy comes from: the fact that the masses were at a distance r gave them gravitational potential energy which is transformed to the kinetic in your example.
So problem number one is reduced to problem number two "how did these two masses get at a distance r"? . And in order to simplify the problem, let us think of the moon and the earth. Where did the moon get its kinetic and potential energy? We are then led to a cosmological model.
The current answer is that the energy was provided at the beginning of time in the Big Bang model of the universe. This model is a General Relativity model, which has a lot of caveats as far as energy conservation goes, ( see the answer by Motl here) but it is true that for flat spaces, where Special Relativity holds, energy conservation holds as usual .
Thus the answer is , after the cataclysmic events of the beginning of time, when the observable universe appeared, it had a dowry of energy in the forms we study in the lab which follows the usual conservation law.