Here is what I believe; whales are capable of passing knowledge down through their generations, just like us. The power of their language is not yet fully understood, but I think it reasonable to assume they are able to express at least simple ideas like "Can I eat this?", "Do not eat that!" and "Those are dangerous to us." A language which can convey those ideas may be sufficient for whales to have memory of industrial scale whaling. I believe Orcas likely remember that humans are very good at killing whales, and subsequently know not to fuck with us. (They may also be able to reason this out by observing our capabilities today, even if they have forgotten what we once did.)
They are also cold blooded so it takes longer for a shark to starve.
I like to think of it as ratios; the number of shark "attacks" far outweighs the number of people killed by sharks. Great whites have been known to be like "yum, a seal!", take a bite, go "what the hell is this??" and then let the person go. Except because they're an enormous shark, the person still has a huge chunk taken out of them in the process, not because the shark was actively hunting a person and was fought off.
Whales, on the other hand, have more ways to do this; they seem more willing to brush and nudge and otherwise interact with things before taking a chomp, which can be seen in some of their non-person-in-the-water interactions with boats and people on piers.