This doesn’t involve naval ships, but there were cases of tanks ramming other tanks in WWII.
The German Tiger was a mean monster. It could easily poke holes through a Sherman, and the Sherman in response couldn’t penetrate the Tiger’s front armor, even with a direct hit. The only hope a Sherman had of taking out a Tiger was to maneuver around behind it and shoot it in the ass (which was featured as a plot point in the movie Kelly’s Heroes). It took on average four Shermans to take out a single Tiger.
The Russian T-34 had a better gun than the woefully undergunned Sherman, but even the Russians had a difficult time against the Tiger’s thick armor. Fortunately for both the Russians and the U.S. forces, the Germans couldn’t build enough Tigers, because the Tigers were just too complex and difficult to build (this is often cited as a classic example of why the “best” weapons don’t always win wars).
While the Russians had difficulty shooting the Tigers, they found out that they had a fair success rate if they just rammed the Tigers. The Russian philosophy, which they still use, is to make things simple, easy to produce, and rugged, and the simpler and more rugged T-34 would often survive the ramming, and the Tiger often would not.
This has been greatly exaggerated, with lots of tales of those “crazy Russians”, but there is some truth to the legends, and T-34s did ram Tigers on many different occasions in WWII. The Battle of Kursk is often cited as a great victory for the Russians and their ramming. The reality of that battle is that while some tanks were rammed, the Tigers generally kicked the T-34’s backsides up and down the battlefield. Once you get past the hype though, there is good evidence that many T-34s did intentionally ram Tigers during WWII on several different occasions, and they were often successful.
There was also at least one case that I’m aware of where a Sherman rammed a Tiger and managed to disable it. during the Battle of Caen. The Sherman shot the Tiger with a direct hit, which the Tiger just shrugged off (a common occurrence in the rare exchanges between Shermans and Tigers), so the Sherman commander just rammed it. The Sherman had hit the Tiger’s track, but the Tiger’s gun still worked. In order to finish it off, the Sherman tank commander quickly got a Firefly (basically, a Sherman upgraded with a much better gun, one that could actually penetrate the armor of a Tiger) and used that to permanently take out the Tiger.