Fire is a chemical reaction, combustion. Both fires and hot things have a lot of energy, so much so they radiate the energy around them, exothermic.
Now when it comes to light, or electromagnetic radiation, this comes from the electrons of the atoms of the molecules that are warm or combusting.
Electrons are weird, they only like to be in certain states depending on their energy and the configuration of the atom they are orbiting.
When an atom is warm, the electrons can have so much energy they jump up into a higher energy level. Imagine a giving a child a red bull, the added energy of the sugar and caffeine will cause them to enter their manic configuration, from relaxed to Satan’s spawn.
Now when the electrons relax back to their “resting” configuration they need to lose that energy. They do this by emitting an electromagnetic wave, the energy of which is equal to the difference in the energy levels.
If you divide this energy (E) by the Planck constant (h) you’re left with the wavelength of the wave (λ). So, depending on the energies released you may get blue light, you may get infrared or you may get UV. Due to the varying jumps of electrons between levels, in most cases you’ll get a mix, which is why when something is white hot it’s really high temperature, lots of wavelengths = lots of energy.
Now, you may be wondering why electrons relax back to a lower energy level if it’s still hot and has a lot of energy. Well, electrons are weird. The chemical and physical world doesn’t like to be high energy, just like us.
It’s unfavourable for any particle to be in a high energy state (entropy) and will relax effectively instantly, realise it’s got too much energy in its ground state and jump up to another energy level again. This will happen billions upon billions of times per second for any particle that has too much energy.
So the result, until the energy has fully dissipated, the hot/combusting things will emit radiation of some form.
Note: I’m on mobile so I apologise if this is formatted horribly.
Other note: I have a chemistry degree so this is the most ELI5 I can go without overcomplicating things.
Latest Answers