A meltdown is unlikely from either of those alone, but if there is damage to the control mechanisms - the control rods and the cooling systems - then it does become possible.
Say it sinks due to a malfunction of, say, the ballast system. Then the crew would have time to insert the control rods in between the fuel rods in the reactor. This means that each rod can be considered by itself, and the reactor is very far from critical mass; there will not be a nuclear meltdown. Even if it sinks to some very deep bottom, and the pressure catastrophically crushes the hull, the rods are likely to remain in place. The rods remain isolated, and the pressure will not really affect the critical mass conditions. I imagine the water will act as a coolant but if the rods are properly inserted the reactor I would think the reactor should be safe.
Say is blown up by some enemy torpedo. If the explosion is large enough, the fuel will likely be dispersed instead of concentrated, which will cause a heck of a lot of contamination but not a meltdown. On the other hand, military submarines may also be carrying a number of nuclear warheads; I am unsure whether a wholesale (conventional) explosion would set them off, but I wouldn't hold my breath: I would swim away as fast as I could.
If there is only partial damage, though, there is a chance that the control rods be in an unsafe position (particularly when running at full power), and the damage prevents them from being reinserted. In that case, there is indeed a danger of a meltdown.
Like all nuclear reactors, nuclear submarines are always at risk of accidents that can lead to a meltdown (and like all modern nuclear reactors, this risk is very very very small). There have indeed been a number of accidents on nuclear submarines, sometimes involving the reactor. Those include K-27 and K-431, which John mentioned, USS Thresher, which sank to the bottom, K-19, which came very close (through a coolant failure) to a meltdown and possibly a nuclear explosion, K-219, which sank to the bottom, USS Scorpion, which also sank, and quite recently Kursk (K-141), which sank due to torpedo explosions.
As you can see, a little of everything has happened without any real meltdowns, and without real danger of one since the K-19. Thankfully, no nuclear submarine has been torpedoed out yet, but it is at least in theory possible that it could have rather catastrophic effects.