Can you cast the produce flame cantrip underwater?
All I could find on this subject was on p. 198 of the Player's Handbook: "Creatures and objects that are fully immersed in water have resistance to fire damage."
Produce Flame does what it says it does — it sits in your hand and produces light, or you can throw it to do damage, ending the spell.
Being underwater does what it says — if the creature you throw the flame at is fully immersed, they have resistance to the damage.
The flame is magic — it isn't something reacting with oxygen.
This is a case of DM interpretation.
Nothing in the core rules indicates why Produce Flame creates light, though it does say that it deals fire damage. As to whether the flame survives long enough to create light or deal damage, the best you can do is adjudicate the spell affect and then be consistent within the world that you create.
The text of Produce Flame (PHB pg. 269) does not specify that the flame behaves any differently than normal flame other than to say that it does not harm the caster or her equipment, which implies that it would damage material that does not belong to the caster even without throwing it. The amount of light cast falls between candle light and lamp light, which implies that it casts light as though it is normal flame.
In adjudicating spell effects, you might consider the difference between Conjuration (which in this case falls under the category of creating an effect out of nothing) and Evocation (manipulation of magical energy) (PHB pg. 203). Even if you adjudicate an evoked fireball to behave the same in an empty room as it does in a pool of water, you might adjudicate this conjured flame to interact with the environment as though it were normal flame based on the difference between conjuring real flame and evoking magical flame.
Having said all of that, I find in my games that maintaining some sense of "normal" behavior and affects is helpful for giving my players a better sense of how to interact with and be creative in this world. Using Produce Flame as an example, we know from the PHB that it produces light and does damage if it is thrown, but the only cue we have to adjudicate any other spell behavior (damaging another character's equipment, lighting flammable objects, creating steam, melting solids, etc.) is the fact that it is called flame. Your players will tend to infer that the spell creates light because it conjures a real flame, and that it does damage because it is hot.
If you go down the "magic" road then your players have to be open to the possibility that the flame may not actually be hot, that it may not create light because it is a flame, but then why bother calling it flame? And how do your players interact with it? If a flame spell is not hot, then you need to consider how that ruling affects all other spells in your world, and whether that will make your players more or less comfortable with exploring spell affects. If spells consistently have unexpected affects, your players will tend to approach new spells by asking whether a spell can actually do something rather than just trying it out. I find creative uses for spells to be one of the more entertaining aspects of D&D and I like to encourage that kind of experimentation.
Lastly but possibly most importantly, taking time out of the game to explain that the spell does not work that way because it is "magic" has proven embarrassing to some of my more shy players for no real benefit.
If a player attempts to use the affect from Produce Flame to create light or deal damage underwater, I would determine the player's approach for using this spell and then either describe the flame behaving normally and immediately fizzling as though you had dipped a lit torch in the water, or possibly sputtering in the caster's hand until she gets out of the water if they intend to continue experimenting with the spell for its' duration.