Mafutu kills the shark because it was eating the fish he was trying to catch, because he was furious that the trap he had spent hours making was about to be undone, and mostly because it almost kills his beloved dog, Uri.
The confrontation appears in Ch. 4.When the scary ordeal is over, Mafutu realizes, "(h)e had done it for Uri, his dog. And he felt suddenly humble, with gratitude."
Mafutu feels this way because he has overcome his fear of the sea, which had taken his mother's life. By saving his dog, whom he also dearly loves, he feels a sense of having reclaimed some of hope for the future as well as a power to influence his world.