The law of conservation of energy cannot be derived. Energy is not concrete; it is not a material substance; it is given meaning through the calculation of numbers. A true historical discussion of the law of conservation of energy is best left to the chapters in this book devoted to thermodynamics. The 19th century law of conservation of energy of Mayer and von Helmholtz (and Clausius, Carnot, Rumford, Kelvin, and maybe some more). For now, just take it as a really good idea.