In my current game, when I first started, somehow a whale got stuck on top of my Hub. It just stayed there, moaning piteously. Even restarting the game, it was still there. Only way I could get rid of it was when I was finally ready to start dropping foundation tiles, so I disassembled the Hub and that freed the whale.
In terms of answering your question, if the whale is well and truly stuck, I see only two alternatives. One is to use the chainsaw to free it. The other would be to kill it. Possible ways? Stack some containers until you can reach the whale, then zap it death. Shoot it with a rebar gun or rifle. Blow it up with explosives.