I understand the reason that a chemical reaction would create photons (physics is more my strong point), but why would it create heat instead? My only guess is that the light released somehow causes the molecules around it to gain kinetic energy through some process and thus create heat, but I don't know how this would occur. What decides whether a given reaction produces photons or heat? I'm a chemistry noob so try to explain using noob-friendly terms. Also, I don't know what tags suit so please put appropriate tags if my tags aren't.
The amount of energy released by a reaction is what most often creates light. Burning, the energetic reaction usually caused by oxidation of something, creates light because the amount of heat released is large enough to heat the reactants or products to temperatures where the radiation emitted contains a lot of visible light (coals in a fire glow red because they are hot enough that black-body radiation has a significant component in the visible).
Most exothermic chemical reactions don't generate this amount of heat and, although they release heat, you don't see it. Hand warming pads, for example, often contain supercooled sodium acetate which can be made to crystallise by popping a small metal insert. The exothermic reaction (crystallisation) releases heat to warm your hands, but not enough to see visible light.
A very small class of chemical reactions produce light directly as the reaction leaves molecules in an excited state which decays with the emission of visible light. Glow sticks are an example of this.
Overall, though, most reactions produce heat because the products have lower energy than the reactants and the released energy has to go somewhere. And it usually just ends up as heat. No photons are usually involved as the energy passes directly into the vibrational and translational energy of the products. So the excess energy in the reactants' bonds ends up as vibrational or translational energy in the products.
Let me put this into a physics friendly form.
When you say heat, heat is not actually an entity of absolute definition like a photon. heat is transference of energy between two bodies. so when you say when heat and when photon is actually like saying, when energy, when photon. it doesn't make sense, since photon has energy. I assume you mean when it does transfer energy in form of light and when it doesn't.
Every chemical reaction has an enthalpy based on how different is the products from reactants. when the reactants has more energy than products, the reaction results heat to transfer into environment (exothermic) when the vice versa, heat transfers from environment to reaction (endothermic) which makes our energy balance solely right. in exothermic case, heat gets absorbed by compounds in environment. if the temperature rises from critical limit that makes electrons in atoms emit light, then photons emit and when not, we just have raise in temperature.
I hope I was simplistic enough.