Gilgamesh was actually an historical figure, appearing on the Sumerian king lists as the ruler of Uruk ca. 2600 BC. Although these lists are not absolutely historically accurate—they claim, for example, that Lugalbanda reigned for 1,200 years—there is a genuine kernel of historicity in them. What this means is that although most of the details of the story of Gilgamesh are implausible, the core of the epic is a story praising the great and important rulers of the city of Uruk.
Another reason Gilgamesh's story was culturally important is that the version we find in the epic tells of an age of heroes. Gilgamesh and other heroic characters are quasi-divine, often descended from sexual encounters between gods and mortals. These characters are important because they mediate between the divine and human worlds and provide a foundation story for the Mesopotamian social hierarchy in which the king is assumed to be granted authority by the gods but is also watched over by the gods so that he dispenses justice according to their will.