Breaching and lunging is a common behavior among humpback whales, and witnessed with ooohs and aaahs by whale watchers. In fact, it is what most whale watchers hope to see. Breaching whales emerge with great power from the water, to slap back down with a loud boom. There are a good number of theories about why humpback whales and other marine mammals breach. And there may of course be as many reasons why humpback whales breach, depending on the situation.
The UCSB ScienceLine writes, "[I]n some cases humpback whales may breach more frequently in rough seas, when their songs will be harder for other whales to hear. They may breach simply to have a look around at what is going on above the water (if, for example, they hear something like boat but can't see it). Finally, the breach may be the end of some complicated underwater behavior that we can't see from the surface. And of course it may just be fun..."
There is also the theory that they are trying to remove parasites or scratch an itch. Also the loud splash may stun prey, or a series of breaches can signal the fitness of the whale. All of these theories make sense and seem like likely explanations. And there are more specific reasons, it seems, depending on who the whale is and what they need. ScienceLine notes that during breeding season, males accompanying females and their calves to feeding grounds will breach as a warning to other males trying to get too close. Meanwhile, calves who have lost their mothers have been seen breaching probably as a way to get her attention and find each other again.
The noise and commotion the come with breaching certainly seems to serve various purposes, and while we ultimately don't know exactly why humpback whales breach, some or all of these theories may be answers to the question.