The formula for the energy of a signal over an interval isn't a derivation. It's a definition. You do that integration and you call the result the signal's energy.
The reason that in the mathematical world we make that definition is because (A) it makes the math handy, and (B) for a preponderance (but by no means all) of the means of signal transmission in the real world, the actual, physical, energy of a signal over an interval really is proportional to its amplitude squared.
So if you launch a radio signal into free space with an antenna, you couple into free space where the actual physical energy of the signal is proportional to its amplitude squared. When you launch a sonar signal into the water with a transducer, the actual physical energy of the signal is proportional to its amplitude squared. When you launch an electronic signal into a transmission line, the actual energy of the forward-traveling portion of the resulting wave is proportional to the amplitude squared. Etc.
So -- just accept it because it makes the math handy, and be happy that the real world happens to fit with an expression that also makes the math handy.