This question is probably tricky to answer accurately. One possibility is probably to look when ancient people and societies started to be seriously interested in history of earlier tribes or started to develop myths and legends like Achilles of Troja. It's not far from making up history to be interested in history. Can you give examples when first a king/tribe started to act clearly (in noted argumentation, unreasonable expensive wars/buildings) in a way to push his historical fame in the future (this means not only for the next living generation, every father wants to impress his family and relatives) but for decades, centuries. When did ancient people start to get interested also not only in their recent history, but history happening centuries ago?
Certainly from at least the time of Hammurabi and his Code of Laws, circa 1780 B.C., as the excerpt below readily shows (translated by L. W. King):
When Anu the Sublime, King of the Anunaki, and Bel, the lord of Heaven and earth, who decreed the fate of the land, assigned to Marduk, the over-ruling son of Ea, God of righteousness, dominion over earthly man, and made him great among the Igigi, they called Babylon by his illustrious name, made it great on earth, and founded an everlasting kingdom in it, whose foundations are laid so solidly as those of heaven and earth; then Anu and Bel called by name me, Hammurabi, the exalted prince, who feared God, to bring about the rule of righteousness in the land, to destroy the wicked and the evil-doers; so that the strong should not harm the weak; so that I should rule over the black-headed people like Shamash, and enlighten the land, to further the well-being of mankind.
If that is not a pitch to history for everlasting fame and glory, I can't think of what might be.
It is theorized that ancient Proto-Indo-Europeans (4000-3000 BC) considered fame and glory as a form of (at least symbolic) immortality. Thus earning war glory was very important for their warriors.
The memory of their deeds was transmitted in oral form by poets.
In connection with this, one should mention the reconstructed expression in PIE language cleu̯os ndhğhitom (retained in Greek as kleos aphiton, Old Indic sravas aksitam) dated to PIE time, which means "imperishable fame" (literally, "non-burnable").
For me, I'd cite Ashurbanipal II and his famed stones he erected to depict some acts. They were the size of fridge and they were made to instruct people, if I recall correctly.
https://en.wikipedia.org/wiki/Ashurbanipal is quite well documented and, on a more humorous note you can also read http://www.badassoftheweek.com/index.cgi?id=461274131521