When an atom has a little extra energy, say from heat or light hitting it, one of its electrons could occupy a higher-energy orbital than normal. This is an unstable situation, so the electron could return to its ground state, or lowest orbital because this is the more stable energy state. In order for the electron to drop down to its ground state, it has to give up its extra energy, either by giving off a photon or causing extra vibration in a molecule.
A photon is a packet of energy. It is almost incorrect to think of it as a particle, because it is an excitation of the electromagnetic field. This is two fields, one electric and one magnetic. This is where it is truly magical, because the electric and magnetic fields oscillate perpendicular to each other, and both are perpendicular to the direction in which the wave travels. The two fields create a self-sustaining electromagnetic wave. This is what we call a photon of light, and this continues until the packet of energy hits something. However, this excitation of the electromagnetic field is true for a huge range of frequencies other than visible light, such as radio waves, microwaves, but also ionizing radiation such as higher frequency ultraviolet light, X-rays and gamma radiation.
What is magical about this is that the speed of light in a vacuum is determined by the physical properties of the electric and magnetic fields in a vacuum. However, this is really fast, and light travels at 186,282 miles per second.
So it is like there is no particle at all, but just excited energy fields. However, we know that a photon will have a definite amount of energy, and it has momentum, giving it the ability to move particles when it collides with something, such as another electron. So light is an energy transfer system, sometimes over great distances.
The amount of energy that a photon has determines its frequency. Higher frequency means higher energy. The energy of a photon is determined by the equation
E = hf
where f is the frequency and h is Planck's constant.
Photons have no rest mass, which allows them to travel at the speed of light. Other particles, such as electrons, acquire mass through their interaction with the Higgs field. Particles with rest mass, which have inertia, cannot travel at the speed of light.

