We usually say that the ultimate source of energy for earth is the Sun. So this means that sun creates energy but according to the law of the conservation of energy energy can neither be created nor destroyed, so how does the energy come into the sun? That is just an example. We know that energy is transformed from one form to another but is not created and destroyed. But that is confusing because there must be an ultimate source of energy. How is energy created in this source? If it is related to the atomic level, then how can atoms possess energy? Is the law of the conservation of energy untrue?
We usually say that the ultimate source of energy for earth is the Sun. So this means that sun creates energy but according to the law of the conservation of energy, energy can neither be created nor destroyed, so how does the energy come into the sun?
The ultimate source of energy in our present universe is the Big Bang. Here is a history of the universe from the interpretation of astrophysical data.
All the energy was created at the beginning of time as we know it, and as the universe expanded various stages of particulate matter appeared, created from that energy. By the time of the Modern Universe at the right of the figure, the energy was apportioned either into mass (nuclear energy is there), or kinetic energy or chemical energy in lumps of matter, or radiant energy. The masses are organized into galaxies and stars within them. The sun is one of those stars and got the energy from the primordial Big Bang.
That is just an example. We know that energy is transformed from one form to another but is not created and destroyed. But that is confusing because there must be an ultimate source of energy.
Astrophysicists have observed and documented the appearance of this energy that is presently locked into nuclear energy and chemical energy, at the beginning of the universe as we know it.
How is energy created in this source?
How all that energy appeared around time=zero is a matter of theoretical speculations.
The fact is that we have a model where once the energy appeared at the beginning of the universe we can explain the whole progress to our present day energy sources.
Matter possesses energy from Einstein's equation $E = mc^2$. This equation describes how matter is a form of energy as well, and can be converted from one form to the other. This is exactly how the sun is power, in a process called Nuclear Fusion. With this idea in mind, check this hypothesis out, called Zero-Energy Hypothesis which simply says that matter is a positive form of energy, and gravity is a negative form of energy, effectively one cancelling the other out to give a total of 0. This is just speculation though. We don't currently have the answer to this question, but at least now hopefully you will understand how a matter body like the sun can produce energy. The sun, in its lifetime has turned 7% of its matter into energy. Some extreme sources of energy could include: Blue supergiant stars - essentially an extremely powerful sun Supernovas - an instant release of more energy than the sun in its lifetime Quasars (and blasars) - supermassive blackholes that fire jets of high energy gamma rays from the north and south poles
Conceptually, the 'source' of energy could be the quantum foam underlying four-dimensional spacetime.
Consider Hawking Radiation, which is the net emission from a black hole consisting of un-annihilated quantum particles. These particles spontaneously 'pop' into existence from the quantum foam everywhere as pairs but then annihilate with each other virtually instantaneously - except at the event horizon of a black hole, where one falls into the singularity and the other escapes.
This yields a net output of energy apparently 'created' from nothing - but in fact the net energy change in the universe is zero, as the particle that falls into the black hole is essentially an 'anti-particle' which decreases the energy in the black hole, and thus balances the equation.
On the universal scale, energy as we perceive it is simply the localised difference between two positive energy levels (one we consider the baseline against which we are comparing the other).
However, entropy draws the universe to the lowest balanced energy state, which is of course zero. There are localised agglomerations of un-annihilated particle clusters which have combined to form net energy values which have not yet existed long enough to be reduced to nothing. We call these agglomerations 'quarks', 'atoms', 'molecules', 'gas', 'dust', 'stars', 'planets', 'flowers', 'people', and 'mice'.
The mice, of course, actually run the whole show.
Energy is time.
In order to provide you with a simplified concept: Energy is what is remaining conserved when time goes by. Any effect has a cause, and any energy state corresponds to a former energy state of the same quantity. Energy conservation means that energy at the end of time will be the same as in the very beginning. And the question: "what was before energy?" turns out into: "what was before time?"
When we talk about energy, we implicitly mean ability to do work. We have a hierarchy of energy, according to how well it can be harnessed to do this. And we find this is related to entropy, how ordered the states of a given amount of matter-energy is. While the energy of the universe is considered to be broadly constant, with some exceptions related to it's expansion, entropy is always increasing. This has been linked in the 'axiom of purification' to the increased mixing of quantum states https://plus.maths.org/content/purifying-physics-quest-explain-why-quantum-exists
Entropy is responsible for the arrow of time, the fact that macroscopic events are irreversible, despite all quantum events being reversible - only general relativity integrates time, quantum field theory and the standard model do not. The main attempt to unify these, string theory, posits additional dimensions to general relativities 4, but that are 'rolled up' and only manifest at very small scales and high energies, for instance in the big bang and when black holes collide https://phys.org/news/2014-12-universe-dimensions.html Time could be the orientation of a manifold or brane in a larger space, possibly colliding with another.