Would a fictional relative of a Mosasaurus, the fictional one being a tad bit bigger, be capable of destroying a ship?
Yes it can.
A Mosasaur is roughly around 50ft long (comparable to a humpback whale) and from what I can tell more durable and probably much more aggressive.
Whales can already sink sizeable wooden ships. Here's an example: https://en.m.wikipedia.org/wiki/Essex_(whaleship)
Now you could have your Mosasaur be slightly bigger for effect, but also maybe have its forehead be bigger and thicker for ramming into ships.
Mosasaurus could reach up to 17 meters length. For reference, that is the average length of sperm whales.
If we look at sperm whales, there are accounts of 26 meters sperm whales sinking 19th century whaling ships.
The whale rammed Essex, rocking her from side to side, and then dived under her, surfacing close on the ship's starboard side. As its head lay alongside the bow and the tail by the stern, it was motionless and appeared to be stunned. Chase prepared to harpoon it from the deck when he realized that its tail was only inches from the rudder, which the whale could easily destroy if provoked by an attempt to kill it. Fearing to leave the ship stuck thousands of miles from land with no way to steer it, Chase hesitated. The whale recovered, swam several hundred yards forward of the ship, and turned to face the ship's bow. The whale crushed the bow, driving the vessel backward, and then finally disengaged its head from the shattered timbers and swam off, never to be seen again, leaving Essex quickly going down by the bow.
Now, considering that middle age ships were less robust than 19th century ships, and that your creature is larger than a Mosasaurus, it's possible that the task can be completed.
This is an adult humpback whale breaching. It's easily reaching over 4 meters in the air.
This is a full size reproduction of a 15th Century or so ship.
You'll note, based on the size of the people visible, that the amidships freeboard is not 4 meters. Thirty or more tons of live whale crashing down in the middle of the ship would probably not be conducive to the structural integrity of the ship.
If your "leviathans" were at least as capable of breaching as a large whale, they could probably snap a cog or early galley in half. Later vessels could likely survive the impact, but would be heavily damaged. If they were ambush predators similar to Great Whites and hunted larger prey like whale by striking from below, this sort of thing might be even more likely.
In the example of the Essex (from the answers by Celestial Dragon Emperor and L.Dutch), a sperm whale rammed a ship. I guess that hurt the whale, but it seemed upset enough to risk that. The mosasaurus has a different skull and jaw. I guess it would try to bite the ship, not ram it, even if the skull is called "robust" by wikipedia.
If the mosasaurus bites a wooden ship, would it try to tear a piece out of the hull or would it spit it out and look for more tasty prey? Depends on the intelligence you are giving it -- too stupid to realize the ship is not edible or smart enough to realize there are tasty morsels inside?
As noted in other answers, Mosasaurs were as large as modern Sperm whales, and likely as aggressive, their body shape is probably not as conducive to ramming attacks as the blunt head of a sperm whale.
However, especially given the sort of technology of the ships described, the Mosasaur could easily snap the oars of a galley, or the steering oars of round ships, rendering the ship helpless in the water. Rearing out of the water would also allow the Mosasaur to snatch crew members from the deck, and if it fall on the deck it would also likely stove in the side of the ship.