Megalodon can only spawn in open water. If you get too close to an island, they will swim away. Megalodon will only spawn in open water away from land. This means if your ship is too close to an island (uncharted islands, outposts, and forts), then there is no way a meg will spawn.