This has been a ... Surprisingly hard question to google, at least for me, unskilled in the way of google-fu. First thing that came up said that the whale had to be chained on the right side of the boat but... How do you get chains around a whale? And how does that prevent them from diving? And why the right side? It just creates more questions than answers, especially when you realize that people were doing this in prehistoric times with canoes. What is the secret? Or am I just seriously overestimating the size, intelligence, and strength of a whale?
The short answer is... whalers didn't keep whales from diving! A hunted whale almost always dived. The thing is, though, eventually they have to come back up to the surface for air.
So, let's go over the whole process by which a whale happily swimming along in the oceans get killed by some comparatively-tiny humans. You mention hunting whales with canoes, which was absolutely a thing. But every whale was hunted with small boats until the mid-1800s, and powered whaling ships didn't fully take over until the early 20th century. (To be clear, harpoon guns were just as important a development as powered ships, but I'll digress no further on that.) Coastal whaling came first, with evidence of it dating back to neolithic times. In coastal whaling, people keep an eye out to sea and if a whale comes close to shore, you launch some boats to hunt it. (Or you can get lucky and a whale beaches itself, but that's not really hunting anymore, it's just butchering a whale that's already dying.) But coastal whaling requires waiting around for a whale to just happen by, and that's no way to run a capitalist economy, so deep-sea whaling was developed around the 1600s, starting with the Dutch. A sailing ship big enough to cross oceans is not sufficiently nimble to catch a whale, so whaling ships carried small craft called whaling boats. When a whale was spotted, the ship would sail as close as it could, then the small boats would be lowered for the actual attack.
At this point the technique of coastal whaling and deep sea whaling come back together- you've got a small boat with one guy standing up in the front where he can keep a watch on the prey, one guy in the back steering the boat with the rudder or a steering oar, and between four and eight men rowing as hard as they could to intercept the whale. (New World and Pacific Islander whalers often used paddles instead of oars, but the number of people involved was the same. There's a logic to every role- you need someone standing to see above the waves so you don't lose sight of the prey. You need someone steering. And everybody else provides propulsion. Not enough rowers and the whale gets away, too many rowers and the boat gets too big to quickly turn and the whales can evade you.)
When they got close enough (within a few yards) to a whale, the man standing in the front would stab the whale in the flank with a harpoon. A harpoon is a specialized kind of spear with two key features- first, the spear point is barbed to catch in the flesh, like a fishing hook. Second, the back of the harpoon is attached to a line (a rope) that is hundreds of feet long. The rest of that rope was coiled up on the deck of the whaling boat.
Now, if the harpoonist was talented, lucky, and strong, he could punch that harpoon right into one of the whale's lungs, and the whale would be unable to dive but would flee along the surface. But that rarely happened- whales are really big, and have a thick layer of fat, and then there's the normal abdominal muscles and ribs. So the idea was to throw or stab that harpoon's barbed tip into the whale's rib muscles.
The whale would then dive! It had just been stabbed in the chest with an agonizingly painful pointy thing, so it's pretty much the most obvious reaction in the world. The whale thrashes its flukes (fins) to accelerate, and disappears beneath the waves. But, the whaling boat is now connected to the whale with the harpoon's line! So as the whale goes under the water and starts trying to swim away, the small boat is being towed along the surface, connected by the several hundred feet of line. You just needed a line longer than the whale was able to dive, and the courage to not let go of the line as your boat get pulled crashing through the ocean waves on a "Nantucket sleighride". But the flight is tiring the whale- it's losing blood from the wound, it's towing an extra weight, and it needs to come up for air sometime. When it surfaced, exhausted, the whaling boat would close in with the whale again (either by reeling in their line or more often by just rowing up alongside again), and then the boat crew would kill the whale with a "lance", a much more typical spear. They would try to stab it in a major artery to finish it off via rapid exsanguination. Once it was dead you'd toss a loop of the line connecting to it around the whale's tail with a slip-knot and pull it tight, so even if the harpoon eventually slipped out, you wouldn't lose your hard-won prize.
Once the whale was dead, coastal whaling and deep-sea whaling diverge again. Coastal whalers just tow the whale back to shore; you get it on to the beach, then get a bunch of people to help pull it on shore for butchery. Deep-sea whalers towed the whale back to the ship, and then it was "made fast" to the ship to prevent it from drifting away. It wouldn't necessarily go on the right side of the ship; which side you put it on depended on the ship's design. And if you had a good hunt and had caught two whales, you'd have one on each side.
Making the whale fast was where the chains came in. You could use rope, but chains were preferred because the upcoming process was going to last for quite a while, and non-synthetic ropes aren't great to leave immersed in water for many hours or days. Also scavengers were going to start showing up and taking nibbles, and while a shark can bite through a rope, they won't have much success against a chain.
As to how they got a chain around a whale, consider that this is taking place on a sailing ship. Modern cargo ships often have cranes, but sailing vessels basically never did, because it was unneeded- you've got masts and yardarms over top the whole ship, so you can just rig a pulley anywhere overhead and there's your crane right there. So you take one end of the chain you're going to use and attach it to one of the yardarms, hanging out over the water. To the other end of the chain, you tie a long line. Let the middle of that line drop in the water, holding the end at the edge of the boat, and most of the length of the line will sink. Pull the whale into position over top the underwater line, then pull the line back in, and now you have a chain around the whale.
The whale is now tied alongside your vessel, and the butchery begins, called "cutting in". Depending on the time and place, the ship might have a "cutting-in stage", which was sort of a platform that could be lowered over the side around the whale, kind of like standing on a scaffold. If that wasn't available, the butchering whalers would just tie a line around their waists and stand on the whale. Using a variety of sharp instruments, the valuable whale blubber would be cut off in strips and pulled aboard the ship. Then, in a process called "trying out", it was boiled in large cauldrons called "try pots" to extract the whale oil. After a few days of hard, stinking, bloody work, the whale carcass was picked clean of all valuable products (blubber, baleen, and from sperm whales, spermaceti), they'd undo one side of the chains holding the whale carcass to the ship, sail away from what was left over, and start looking for more whales to catch.
(Edit: corrected a few spelling errors. Then edited again for more spelling errors.)