The serra is a large air-breathing fish, about 10m long, with a long serrated crest coming out of its forehead. It is predatory, and lives similarly to a shark. However, it has one unique feature, that being that it often attacks ships by attempting (and if the ship is made of wood, often suceeding) to saw through the base of the ship, sinking it. What use would this behaviour have for the serra, and why would it evolve?
Because the creature evolved to attack from beneath its prey, which was something similar to a whale.
From below, a boat looks like a long, taper-ended object much like a whale silhouetted against the sky above the water. In fact, boats, being dark below the water, would stand-out more than whales, most of which have evolved light coloured bellies to camouflage against the light above.
All I can say is that the creatures that sink boats (a recent invention in evolutionary terms) have not evolved or learned to distinguish between the two.
It is itchy.
It is so hard to get a good scratch out in midwater. Water is not scratchy at all. More just splashy. The bottom is soft and muddy and it just makes you itch more. If something comes floating along that is hard and big enough to offer that good scratching, you gotta scratch!
That is how it is with your fish. It is itchy. When a boat comes it wants to scratch and boat wood offers first rate scratching.
Often one fish will be satisfied with a few minutes of scratching and the damage to the boat is reparable. But that scratching sound travels a long way underwater and if there are any other itchy fish in the vicinity they know what it means. Scratching time!
It is playing/trying out its might/territorial
We can look at Orcas. They have been seen attacking boats, or at least bumping the hull or the rudder. It is believed some attacks about a year ago were done by some 'teenage' orcas. It was most probably just a way for them to play. Play often has some deeper meanings, which in this case is having a certain power over other objects or creatures.
The Serra would attack to see what power it has over these objects in the water.
An alternative is simply that they are territorial. Something is in their waters. It doesn't matter if it's edible or not. It needs to be attacked so it'll know its place.
They are laying eggs
The serra are air-breathing, as stated, and live or frequently return to the delta of a large river (such as the Amazon) to lay their eggs on naturally formed floating islands that drift out to sea from time to time. They saw up through the islands from beneath to lay their previously fertilised eggs in an environment where there is plenty of food available for the young when they hatch. (How fertilisation occurs prior to egg laying is out of scope for this answer and a private matter for the serra.)
- Allows the young serra to survive the early stages of their life when their lungs are too undeveloped to manage long periods of submersion.
- Allows the older serra to reproduce without risking becoming beached by venturing into shallow waters.
- Ensures that the young serra are in a position where they can immediately enter the salt water as soon as they have matured sufficiently.
- Protects the immature serra from the majority of predators that would threaten them on the land or in the water.
Unfortunately for human mariners, the serra haven't kept up with evolution and see ships as potential breeding opportunities.
Tuning the threat: Their ship-attacking behaviour can be made:
- Seasonal - the serra are conditioned to only attempt to reproduce during the time of year when flooding routinely sends floating islands out to sea;
- Geographically limited - the serra return to a certain area near the coast where floating islands are most common to reproduce and ignore ships in other areas; and/or
- Frenzied - there's a shortage of floating islands and whenever one appears the serra mob it to ensure that their genetic legacy continues.
Competing or prey species are vulnerable to heavy attacks from below, and as other commenters have said, it doesn't know any better when it attacks ships.
Alternatively, while it's true that it was adapted for attacking other megafauna, the Serra is smart - it's learned that ships have edible little bipeds inside. Like a piñata. There's significantly less to eat than if it were a real animal, but ships - especially wooden ones - are sitting ducks in comparison to the speeds a shark would be capable of.
Or, maybe, the Serra is a keyhole species that lives coastally and constructs some kind of shelter, fish trap, or other desired structure from deadwood and trees within a shark's reach?
Perhaps the Serra lives in a structure, natural or otherwise, but has adapted to attack and destroy the homes of other sharks to display dominance, establish or defend its territory, etc., and is also capable of using this destructive potential on what it perceives to be food or a threat.