According to Hesiod - the poet who, along with Homer, created the first guides to ancient Greek religion and customs - there were 5 ages of mankind. In the 4th of these ages, Zeus, the king of the Greek gods, created a race of men especially powerful and noble. They were mortals, but they were "god-like".
This Heroic Age, which spanned approximately 6 generations according to ancient genealogy, was the time of legendary figures like Perseus, Heracles, Jason, Achilles, and Odysseus. All of the greatest heroes of ancient Greece lived during this 4th Age. It was a time of great adventure but also turmoil and bloodshed. Most of its heroes died in battle. The Greeks who recounted these legends centuries later believed they were living in a far less glorious 5th Age of mankind.
Was any of this heroic history based in reality? Historians of modern times were very skeptical until the shocking findings of German archaeologist Heinrich Schliemann in the 19th century. In his quest to show that the events of Homer's epic poems were rooted in historical events, Schliemann unearthed a goldmine of Bronze Age artifacts and structures at multiple sites (including what is now widely believed to be the site of Homer's Troy).
The excavations carried out by Schliemann and later archaeologists have revealed that this Late Bronze Age civilization, which we call Mycenaean, was the first advanced civilization in Greece (and one of the most advanced in all of Bronze Age Europe). The Mycenaeans built lavish palaces, as well as bridges, roads, and aqueducts. They also provide us with the first evidence of written language in Greece (called Linear B). Many of the religious figures and customs referenced in Homer can be traced back to the Mycenaean period.
But Mycenaean civilization essentially vanished from the historical record around 1100 BCE. Many of their palaces and city centers were either destroyed or abandoned, leaving no clear accounts of what happened. Modern archaeologists are torn on the subject; some believe outsiders invaded their cities, while others claim internal conflict caused the civilization's demise. Regardless, the grand culture of the Mycenaeans was no more.
The 300 years or so that followed the collapse of Mycenaean civilization is known as the "Greek Dark Age". Those who remained had a new lifestyle, characterized by a general decline in sophistication. They no longer used a writing system, nor lived in large settlements with elaborate infrastructure.
But even though the splendor of Mycenaean times may have been beyond their reach, it was not forgotten. Memories of those more prosperous times, along with remnants of Mycenaean religious beliefs and customs, continued to be passed from one generation to the next.
Around the 8th century BCE, Greek civilization reemerged. They began using a new alphabet adapted from the Phoenicians. Society and life became centralized once again, but this time around the polis, rather than the palace citadels of the Mycenaeans. The first Olympics took place in 776 BCE and the works of Homer and Hesiod were composed. Greece was well on its way to another golden age.
When one understands this historical progression, the role of the ancient Greek heroes becomes clearer. Greeks of the Dark Age could not help but idealize their past, which truly was exceptional in many ways. The impressive ruins and relics of the Mycenaeans were all around them, which only reinforced the power of these legends. Homer, Hesiod, and other epic poets ultimately consolidated the stories which had been passed down and made them their own.