This is my first question and I am just a 14 year old so excuse me for my mistakes. Please simplify your answer a little only. Using terms thinking I won't understand is a mistake.
We believe that there exist something called an electromagnetic field, this is an invisible interaction, just like gravity that pulls you down, the electromagnetic field is a force that acts on magnetic matter and electric charged matter.
The photon is an excitation of this field. Think about it this way if the electric field was a big sheet of cloth, the photon is the waves that happen on the surface. The electron can create photons because the electron is electrically charged so it can create an electric field around it, and if the electron moves quickly or oscillates, it will radiate these waves (photon), just like if you take one part of the cloth sheet and move it quickly or move it Up and down, you'll see a wave going out of the place where you move it.
I tried to be very brief but please ask me for more clarification if needed.
A simple picture:
From classical electromagnetism we know that an accelerated charge radiates electromagnetic waves.
One of the reasons we arrived at the quantum mechanical model of the atom is because, classically, an electron rotating around a positive charge, because of the radial acceleration would radiate a continuous spectrum until it fell on the positive charge and neutralized it. This evidently did not happen because atoms, as the simplest one, the hydrogen atom, exist and are stable.
When an electron fell onto a proton to form hydrogen, observations showed a specific energy spectrum was radiated
which can be be fitted with mathematical series , at discrete frequencies.
This led to the Bohr model of the atom, where to explain the series, it was postulated that there existed orbits of the electron that were stable unless they were excited with an incoming radiation, and the lines seen were transitions between orbits.
At the same time, Planck postulated the photons, discrete particles which built up light with frequency h*nu, to explain black body radiation.
The discovery that the Shrodinger equation could give solutions for the hydrogen atom electric potentials and they fitted the hydrogen spectrum, tied the whole thing up.
Photons are the quantum of the electromagnetic spectrum, and they are absorbed or radiated in interactions with atoms because the atom is mainly held together by an electric potential, which gives quantized energy levels , and not the continuum of classical theory which had no photons.
There is a big problem with quantum mechanics: it is highly abstract and sometimes counterintuitive when you are about to go deeper. Don't worry, anybody interested in quantum mechanics had to face this. The fact, that you are concerned by this is the good sign that you will pass successfully.
The massless photon is massless in terms of stationary mass. The whole energy is in form of kinetic energy in terms of Enistein's special relativity. When the photon is stopped, its whole energy is transformed in any other form and it's energy comes to zero, co it ceases to exist at all. The photon, actually, is just a theoretical construct to trick our minds to be able to digest all the properties of light.
The photon, at its origin, is just a theoretical construct how to describe the Planck's quantum theory where the energy is not radiated via continuous energy stream but in small chunks. Those energy chunks were called the photons.
You know that ideal pendulum stores mechanical energy in forms of kinetic and ptential energy. You know that connected pendulums can transfer the energy from one point to another. Try it with your friend. Hold a rope on both ends, strain it a little and then swing the hand holding a rope. You will see a hump running towards your friend and finaly swingign his hand. If we consider the rope the electromagnetic field the hump is the photon. The problem with the cloth example is that the photon-hump is localized both in distance from you and direction from you. It looks more like a ball sent from you somehere when the observer is below (and can see only the cloth shape). And the hum doesnt represent the actual displacement but the amplitude of the oscilations in te position of the hump.
The hump wasn't there when you swung your hand; it appeared (like photons do when excited atom comes to the stable level) and it disappeared when it hit your friend (like photons do when they hit atom exciting it).
One shouldn't think of a field as a surface, a field is a mathematical computation of a phenomenon. It is an abstraction. Really what the field is, is a force at each point. When the source of a field jiggles, then the realignment of the force values at each point happens in a motion that can be approximated to a mathematical wave. But this realignment carries an energy in and of itself, which is the energy associated to a wave. One can see that this is all mathematical mumbo-jumbo for a physical phenomenon that is hard to imagine.
A photon, again, is only the "unit", so to speak, of this realignment. Clearly it cannot have mass because it's not an object, it is an abstraction.
If you release the potential energy stored in a piece of water that is mechanically lifted above the water surface level, the energy will radiate in the form of waves. These waves carry away energy, but are massless.
In an atom, the potential energy from moving the electron in the Coulombic potential (the attraction of an electron and a proton) is also released as a wave, but the force that causes the potential energy is electromagnetic and the resulting wave is electromagnetic.
Now, because of quantum mechanics there are discrete energy levels and light quanta - photons, but it is still an electromagnetic wave.
You are right, photons are massless and is only a form of energy.
Since electron on getting energy goes to higher state but becomes unstable simultaneously. So it rejects the extra gained energy to achieve its stability.
Now, this energy has to go somewhere and experimental data shows that on achieving stable states light bands of equal frequency is produced. Equal energy suggest that no conversion of energy or loss has taken place.
Since bands were discrete then some discrete particle is being emitted. And photons are the dicrete particles present in light constituting only energy. Thus photons are produced.
NOTE: If you are unaware of or doubt any term, read about them which will help you resolve your doubt.