Gilgamesh, befitting his epic hero status, wants to fight and kill Humbaba to prove to his people that they should not be afraid of Humbaba and that the gods are able to be defied by mere mortals. Also, perhaps as a secondary motive, he wants to be able to inspire the youth of Uruk with his mighty deeds to encourage them to be great and powerful in the same way that he is. Note what he says in the following quote:
I want to prove
Him not the awesome thing we think he is
And that the boundaries set up by gods
Are not unbreakable. I will defeat him
In his cedar forest. The youth of Uruk
Need this fight. They have grown soft and restless.
Gilgamesh therefore openly states that part of his reason for wanting to fight Humbaba is to confront the fear that his people have of him as an "awesome thing" and also to challenge the gods in setting up their boundaries, which mortals think are "unbreakable." Of course, these motives, with their arrogance and hubris and defiance, are completely fitting for an epic hero who is determined to make a name for himself by doing what others do not because they are too afraid.
Your question implies that it was necessary for the two heroes to kill Humbaba, but this is not the case. The Elders of Uruk and Enkidu both try to persuade Gilgamesh not to fight the monster. His own mother, the Goddess Ninsun, is unhappy about the expedition. She asks the sun god Shamash:
Why have you imposed a restless heart on my son Gilgamesh?
Now you have touched him so that he wants to travel a long way to where Humbaba is.
He will face fighting such as he has not known
He will travel on a road that he does not know
Although there is a suggestion in the text that the people will rejoice if Humbaba is killed and that he is hated by Shamash, the underlying message is that this adventure is foolhardy. This is not just because of the dangers involved, but because Humbaba is the official guardian of the cedar forrest, appointed by Enlil himself. Gilgamesh and Enkidu know that killing Humbaba will anger the gods. Enkidu says:
[Kill Humbaba] before the preeminent God Enlil hears... and the gods... be filled with rage against us
Consequently, when the council of the gods decide that either Gilgamesh or Enkidu must die, the reason is that:
...they killed the Bull of Heaven and have also slain Humbaba
So the slaughter of Humbaba was by no means "necessary". In fact, it was a foolish quest that lead directly to Enkidu's death. It was caused by Gilgamesh's selfish desire to "make a name" for himself. Only at the end of the story, after all of his attempts at securing immortality prove futile, does Gilgamesh realise that it is better to preserve life (like the flood hero) than to destroy it.