The gravitational collapse of a cloud of mostly hydrogen in the vacuum of space.
And anything falling together under gravity was given that kinetic energy from somewhere* and ultimately it can all be traced back to the Big Bang.
As for where that energy came from, it's possible we'll never know. Most organised religions (and no doubt a few disorganised ones) have their theories, of course. You may subscribe to one of these.
This is the principle most commonly simplified as "what goes up, must come down"