Where does conservation of energy come from?
A physicists/mathematician named Emmy Noether developed a theorem in 1918 that should've made physicists realize exactly where certain laws were coming from, but most physicists don't quite realize the implication. ... snip ... That theorem (Noether's theorem) states that conservation laws are the same thing as saying the Lagrangian of the system obeys a symmetry.
As an example, conservation of energy comes from the fact that the Lagrangian is invariant under a translation in time. Work the math out, and that gives you a conserved quantity, called the Hamiltonian, whose eigenvalues are the energy of the states in the system.
So asking "where does conservation of energy come from" is the same thing as asking "why is the Lagrangian invariant under time translation?" The answer's simple - because physicists like it that way. One of Newton's greatest observations was that if you avoid air resistance, and the local effects of friction and gravity, objects tend to keep doing what they were doing before. In other words, their Lagrangian is time invariant. But note what you had to do! You had to ignore friction, gravity, and air resistance - instead, what you do is just parametrize their effects, and quietly say "well, the energy loss goes elsewhere," you presume it's the atmosphere and local heating of objects, and poof, you're good. Similarly, you say "well, the energy comes from elsewhere" with regards to gravity. Now, it turns out you can write a Lagrangian which is time invariant which includes the atmosphere, local heating, etc., so you don't have to ignore it.
But you see the pattern - whenever physicists come across violation of conservation of energy, they don't call it that. They parametrize it, and quietly shove the time-dependence into another term, and claim "energy is conserved!" I'm not criticizing this, mind you! It makes sense, because if the Lagrangian they're writing down is supposed to describe the Universe as a whole, it should work at all times, because there's no universal "reference time" you can use. One time looks just as much like any other time, right?
Ah ha. Here comes the interesting realization. There is a universal reference time. The Universe is finite. It began. We look up and we see a universal microwave background everywhere. The temperature of that background can actually be used to calculate exactly how much time has passed since the time of recombination. That's a bit of an experimental trick, though - you can also determine the amount of time since the Big Bang by simply reversing the direction of all galaxies and figuring out when they would've come from a point.
There's a problem, then. We're using a Lagrangian which is time-invariant to describe a system which is manifestly not time invariant. If you try to match the Lagrangian to observations of that system, you would expect to find violations of conservation of energy! Unsurprisingly, you do. Once again, though, we have physicists at their best. When they discovered the acceleration of the expansion of the universe (hello! that's a violation of Newton's first law!), they didn't say "violation of conservation of energy discovered at the largest scale." They quickly said "evidence for a cosmological constant found." And now dark energy is often called "the energy of free space."
Or, "the energy comes from nothing." Gee, that sounds like violation of conservation of energy, now doesn't it?
Dark matter actually follows a similar trend. We saw objects in space that showed more potential energy than could be accounted for. "Violation of conservation of energy"? Nope. Some unseen, invisible objects generating a gravitational field. Dark matter.