The equation E = mc^2 you mentioned is actually a special case of the more general equation for energy, and it applies specifically to objects with rest mass.
For particles with rest mass, such as a massive object like your example of a 1-kilogram object, the equation E = mc^2 can be used to calculate the energy based on the mass and the speed of light. In this case, the mass (m) refers to the rest mass of the object. When the object is at rest, its energy is solely due to its mass.
However, for photons, which are particles of light, they are massless. Photons always travel at the speed of light (c), which means their velocity (v) is equal to c. Therefore, you cannot use the equation E = mc^2 to calculate the energy of a photon because the mass (m) is zero.
The energy of a photon is given by a different equation derived from the principles of quantum mechanics. The energy of a photon is proportional to its frequency (f) and can be calculated using the equation E = hf, where h is Planck's constant (approximately 6.626 x 10^-34 joule-seconds).
In summary, the equation E = mc^2 is valid for objects with rest mass, but for massless particles like photons, their energy is given by the equation E = hf, where h is Planck's constant and f is the frequency of the photon.