How does the Megalodon work?

Solution 1:

In the sea of thieves wiki is no level connected to megalodon spawn mentioned and it seems to be random:

The Megalodons are vicious predators that appear around pirates at sea, different versions spawn less frequently and have unique attack patterns. They sometimes remain passive, but otherwise start to encircle its target before charging the ship for major damage and knockback. Defeating a Megalodon takes around 12-15 cannonball hits on a Sloop, around 15-18 cannonball hits on a Brigantine and around 30-32 cannonball hits on a Galleon.

and

Megalodons can spawn anywhere in the wide-open sea, however they will not go near Islands, Seaposts or Shipwrecks, so if you want to get rid of a meg that's chasing you, sail close to one of these landmarks.

About stopping it charge:

Every now and then, the Megalodon will charge your boat. A special musical cue will accompany the charge. The charge will leave a ship with 3-4 holes, do around 50% damage to a player and knock them back. 2-3 cannon shots in the charging Megalodon's mouth will disrupt its charge, leaving just one small hole in the hull and negating its knock-back effects.