As the story progresses, Gilgamesh becomes less intent upon worldly pleasures. He begins to treasure a real friendship with Enkidu and seeks to perform heroic deeds.
At the beginning of the story, Gilgamesh is fully focused upon bedding every bride of Uruk before she consummates her marriage. Some experts call this the "right of the first night." After Enkidu challenges him to a duel, however, Gilgamesh turns his focus towards achieving great feats and becoming famous for them. Meanwhile, Enkidu admits Gilgamesh's superiority and decides to let him take the lead in their adventures after the latter defeats him in battle.
For his part, Gilgamesh not only proposes defeating Humbaba, the demon guardian of the Cedar Forest, but he also expects to make a name for himself for doing so. Gilgamesh and Enkidu are assisted by the sun god, Shamash, in their efforts to defeat Humbaba. After Gilgamesh inflicts the killing blow on Humbaba, he is ecstatic at his accomplishment. However, he is soon propositioned by the goddess Ishtar, who desires to have him for a lover. Gilgamesh balks at Ishtar's request, arguing that Ishtar's record of destroying her previous lovers leaves him with little confidence that he will be able to keep her happy.
Incensed by his rejection, Ishtar convinces her father, Anu, to send the Bull of Heaven to avenge her humiliation. However, Ishtar's plan falls apart when Enkidu and Gilgamesh manage to defeat the Bull. After the Bull's death, the gods decide that one of the two friends must die for killing both Humbaba and the Bull of Heaven. They decide upon Enkidu, and this brings immense grief to Gilgamesh.
This is a great change for Gilgamesh. Previous to meeting Enkidu, Gilgamesh was focused solely on himself and his physical pleasures. He was a despotic monarch, and he derived great satisfaction from his cruelty towards the citizens of Uruk. However, his friendship with Enkidu changes him from a hedonist to an austere idealist. He works to destroy evil, albeit for the purposes of making a name for himself, and he begins to cherish the value of a good friendship. He even spurns the beautiful Ishtar because of her depravity. Essentially, Gilgamesh rejects debauchery and becomes more focused on living a meaningful life.
After Enkidu's death, Gilgamesh grieves deeply for his lost friend. He turns his thoughts towards the eternal and strives to search for the secret to immortality. Gilgamesh meets with Utnapishtim in the hopes that he will discover the secret of eternal youth. In the end, however, Gilgamesh discovers that man is fated to die and that he must accept his mortality. Essentially, Gilgamesh comes to the realization that all men are powerless against old age and death. It's a great change for the warrior-king: he learns that there are some things that even monarchs cannot change.
An interesting question. Gilgamesh undergoes a number of important changes.
He was a bad ruler (essentially a sloppy tyrant) until the people pray to the gods, who create Enkidu to help them.
After they fight, they become friends and Gilgamesh becomes a better ruler. He shifts from abusing power to wanting to do great things. Essentially by gaining a true friend he becomes a hero.
When Enkidu dies, Gilgamesh travels to the land of the dead to try to get him back, but can't. Gilgamesh weeps, but gains wisdom.
So, bad ruler to good.
Non-hero to hero.
Alone to true friend.
Shallow to wise.