Boring scientific story.
Maybe they used sodium which will "burn" as soon as it touches water. And white phosphor will also burn underwater. Stuff will burn underwater if 3 conditions are met. Having fuel, having heath and having oxygen. If all 3 are present underwater, fire will light. White phosphor needs very little heath, and will burn at lower temperatures than the boiling point of water.
Water does not put out fire, or at least, that is not a property water has directly. When using water to put out fire you are merely lowering the fuels temperature and when the it gets too cold fire goes out. And yes, there is oxygen underwater. If there wasn't fishes and other underwater animals wouldn't be able to survive.
Of course, you shouldn't take SpongeBob too seriously. I don't deem it possible to find a sponge living in a pineapple working for a fast food restaurant, wearing clothes and a squirrel wearing a diver's suit living underwater in a dome made of plexiglass, so why moan about fire underwater which is scientifically possible....