A new paper published in the journal of Ecology makes quite the conclusion: octopuses will punch fish simply out of spite, or anger.
These punches are typically thrown in order to “prevent exploitation and ensure collaboration.”
However, the punching often wasn't connected to any reason in particular, suggesting octopuses were simply knocking fishes upside the head out of spite, anger, or just because.
The occurrences witnessed by researchers happened in the Red Sea over the course of 2018 and 2019 and involved different octopuses in different locations, which means the conclusions aren't based on an isolated incident.
When they're not fighting, octopuses & fish do have an unusual interspecies collaboration when it comes to hunting, which you can read more about here.