The standard Babylonian version opens with a formula, "he who saw the deep", and closes by returning to the same city walls it began with. Gilgamesh, part divine and oppressive to his subjects, is matched by the gods with Enkidu, a wild man of the steppe who is civilised by a week with the temple woman Shamhat and then loses the ability to run with the animals. The two fight, become inseparable, and go to the Cedar Forest to kill its guardian Humbaba. Gilgamesh rejects the advances of the goddess Ishtar, insultingly, and she sends the Bull of Heaven; the two men kill it too. For these offences the gods condemn Enkidu, who dies slowly and describes the house of dust that awaits the dead.
The second half is the consequence. Gilgamesh, undone by the death and by the recognition that it will be his own, crosses the waters of death to find Utnapishtim, the one man granted immortality, who tells him the flood story and then demonstrates that he cannot stay awake for a week, let alone live forever. A plant of rejuvenation from the seabed is stolen by a snake on the way home. Gilgamesh returns to Uruk with nothing except the walls he built, which the poem's last lines invite the reader to inspect.
Tablet 12 is a separate matter. It is a partial, fairly literal Akkadian translation of part of a Sumerian poem about Gilgamesh, Enkidu and the netherworld, appended to the eleven-tablet sequence in some copies. It contradicts the narrative, Enkidu is alive again, and most translators either relegate it or omit it, while noting that ancient scribes evidently thought it belonged.