Unlike some previous editions in which the fireball will adjust based on the space available and spread down corridors if contained, 5th ed simply states that the fireball will take up the amount of space listed as 20' radius sphere and spread around corners to fill that space, never expanding to exceed that distance from the point of origin. This specifically breaks the line of sight rule on page 204.
So if cast at the entrance of a 10x10 room with a 5' corridor leading into it, it shall fill that room and spread 20' down the corridor.
Fireball PHB PG 242
The fire spreads around corners.
It seems to be that the Orb refrains from freezing the liquid if it is cast underwater.
The intention seems to be that throwing the orb underwater wouldn't be considered striking the water. Striking usually refers to as one thing coming into contact with another, with the intent to hit, and when your orb 'strikes the body of water' isn't clear. It is also IN a body of water, so the orb isn't really capable of striking a body of water if it is already in one.
If the globe strikes a body of water or a liquid that is principally water (not including water-based creatures), it freezes the liquid to a depth of 6 inches over an area 30 feet square
Emphasis mine.
While getting into a bit of semantics depth is the distance from the top of something to the bottom. It would be slightly unintuitive if one could consider something 'the top of' if it started in the middle of something, such as the ocean or body of water you are in. Depth doesn't seem to apply properly in this scenario.
If it froze underwater using area and depth would be an inconvenient way to do things.
If the intention of the spell was to properly freeze while cast underwater it would, for more ease and out of a normal expectation, probably freeze in a radius or a more spherical shape. The wording of the spell seems to indicate it is made to freeze the surface of water. It is measured in area and with depth included, not a measurement and description you would use for underwater (at least not normally).
With this and the phrasing of 'strike' and with the observation that the area the spell freezes is an 'area' (with a six inch depth) it can be argued that the orb would not instantly explode with contact with water, if it were already underwater. But further on...
It would not freeze any water.
The freezing of the water is not directly related to the cold damage the spell does. With the orb not properly preforming it's second function, the freezing of water, there is no reason that the freezing would take place. Cold damage does not freeze water without DM intervention (or a certain effect says so, like with the case of some spells like Wall of Water).
Lastly...
There is no difference between casting the spell or taking the orb and throwing it.
It shatters on impact, with the same effect as the normal casting of the spell. You can also set the globe down without shattering it. After 1 minute, if the globe hasn’t already shattered, it explodes.
Emphasis mine.
Outside of a slight word difference between 'explodes' and 'shatters' the spell functions the same whether you are throwing it or casting it and throwing it instantly as apart of the spell. There is no difference between the orb shattering or exploding in a body of water. As long as the orb doesn't strike the water it shouldn't be.
Perhaps more is needed....
If designer intent was that the spell was to instantly freeze water it hit (or started in), excluding water based creatures such as elementals, then it could be that this interpretation is incorrect. I've tweeted Crawford over the issue to see what the intent is.
Best Answer
Unless there are some secret rules written away in the DMG or PHB that details how water affects magical and elemental occurrences, the fireball should occur normally.
I think earlier editions had rules where lightning would spread out in an AOE (area of effect), but as far as I know that doesn't exist in 5e. This isn't to say fire would spread in a larger AOE under water, but to show that there have been situations where magic is affected by water.
But seeing as the spell doesn't detail anything happening if the spell is submerged or the area the spell occurs is covered in water, the spell should progress as normally.
The fire spreads around corners. It ignites flammable objects in the area that aren't being worn or carried.
The good news for the goblin is he will be taking half damage. PHB 198 says...
Outside of that fireball seems to still work in full.
What happens to the water though? It just had fire flood all around the inside of it.
Rules as written: It doesn't say or really hint or imply that anything would happen. With this in mind I'd say the water is still there. Perhaps it bubbled violently and got a bit steamy. Though with how brief the fire lingers in an area I imagine the water would stay. This is more of an opinion but I base it around that the PHB provides no insight on what would happen.
You could consider the water 'ignitable' and that it steams away but that's a choice as DM.
Official ruling to Does Fireball evaporate water?: