Actually, I would not be shocked to learn that this squid was in the midst of being attacked by a whale or two and [as is their defense] latched onto the passing boat mistaking it for a whale.
Your post conjured up a whole sequence for me.
The squid is being attacked, maybe fleeing from one or more whales, as you suggest, when something looms up in front of it.
It can't dodge and decides to fight back so it reaches out and embraces it's tormentor in a death grip and thinks (the squid equivalent of) "all right, you bastard, you may kill me but I'm taking you with me."
But the opponent doesn't fight back. It just continues to travel on, away from the pursuers.
"Fine, you want to play it that way! See if I care. I'm not letting go. You're doomed, whale boy!" it thinks, then leans against the hull of this ship and sighs, waiting for death.
Many hours (or days) later the squid realizes that the thing it's grappled with isn't trying to kill it and and has taken it out of range of the pursuers. With difficulty the suckers are loosened and it falls away, exhausted, but alive.
The last thing it thinks before moving away quietly is "Just Damn! That was lucky. I wonder what the hell that thing was? Big dumb fish if I ever saw one. Next time I'll have to see if it tastes good."