Were these names common at the time? Were Greeks named after legendary characters?
The short answer to your question is that, yes, there would have been real people with the names of heroes and gods, but no, they were not common.
The long answer is that Ancient Greek naming conventions are a complex and fascinating topic. On the one hand, there are no surviving sources that explain to us how or why the Greeks came up with names for their children. Ancient authors do not seem to have found this topic interesting enough to write about. On the other hand, Greek names form a tremendously large body of evidence - the Lexicon of Greek Personal Names claims to have published as many as 215,000 so far - and the fact that most names are composed of words with a direct meaning in Greek means that they present a unique window into the social world of Ancient Greece. Because of their components and their meaning, names can often tell us about people's place of origin, family ties, social status, cult practices, looks, and so on.
With the exception of some restrictions on the naming of slaves, there do not seem to have been any particular rules about what people could and could not be named. We might expect, for instance, that it was frowned upon to give your child the literal name of a god or goddess, but there's no evidence that the Greeks actually found it taboo. Admittedly the names of divinities, while becoming more popular after the 1st century AD, are rare enough in the Classical period (5th-4th centuries BC) that individual known cases have been extensively discussed by scholars. However, they are not altogether absent. There certainly were people named Artemis and Leto. This shows that there were no hard limitations to what a child could be named, but only conventions by which most names were chosen. The only names that genuinely don't seem to have been used at all were those of underworld gods (Persephone, Hades).
So what were the conventions they stuck to? One of the most powerful factors, especially among elite families, was the names of ancestors; some sons were named directly after their fathers (such as Perikles, son of the famous Perikles), while others were named after their grandfathers (like Kleisthenes, father of democracy, grandson of Kleisthenes the tyrant of Sikyon). Modern scholars are on pretty firm ground when they assume that people with similar names are related; often a name would "run" in just one family, sometimes for centuries. A related strong influence was the desire to express social status (again especially among the rich), which meant that many wealthy people would have names that contained words like aristo- (the best), -archos (leader), and especially mutations of the word hippos (horse). The latter is often regarded as a firm indicator of high status, since only the richest men in Greece would be able to afford to own horses, and horse-riding was the favourite pursuit of the leisure class. Famous examples include Perikles' father Xanthippos ("yellow horse"), the physician Hippokrates ("horse power"), and Philippos II of Macedon ("horse lover").
If there were no particular traditions binding new parents, they would be able to choose a name they liked. Endless possibilities are known. Particularly striking to us, though not necessarily the most common, are male and female names that contain a direct reference to warfare - Kallimachos ("beautiful battle"), Archestrate ("army-leader"), Nikomachos ("victory in battle"), Andromache ("battle of men"), Deinomache ("terrible in battle"). Other names are more straightforward, like Leon ("lion"), Kephalon ("head") or Melissa ("honey"). People were named after cities, mountains, and, very commonly, rivers; Aristotle complains about rare and ridiculous names like Hermokaikoxanthos, a pile-up of the names of 3 rivers. Generally, words like kalos (beauty), stratos (army), agora (marketplace), demos/damos (people), -anax (king) and old values like bia (strength) and kratos (power) occur often in what we might call "posh" Greek names. The combinations don't always make sense; what sort of a name is Isagoras ("equal marketplace") or Iphikrates ("strong strength")?
Interestingly, while the actual outright names of gods are extremely rare, by far the most common type of name in Ancient Greece was actually the indirect reference to a god or goddess. There were 2 ways to do this. First, the name of a god could be easily adapted into an adjective form, so as to become a name derived from a god rather than the god's name itself. Some of the most common were adaptations of Apollo (for example into Appolonios), Dionysos (Dionysios), Artemis (Artemisia) or Demeter (Demetrios); the latter is still in common use now, in its vowel-shifted form of Dimitri. One of the most famous examples of such a godlike name is Alexander the Great's companion Hephaistion (from Hephaistos). The second way to adapt divine names was to add words to them - most commonly kleos (glory),-doros or -dotos (gift, given). So we have authors like Diodoros ("god-given" - the reference is to Zeus), Apollodoros, Asklepiodotos; in the Roman era, when Eastern gods made their way into Greek lands, new names like Isidoros (gift of Isis) crop up. While it has proved impossible to say with categorical certainty that names are an indication of which gods were being worshipped in a given place, regional patterns are very clear in the evidence, and names derived from gods are at least a clear indication of which divinities were considered important. Perhaps the most touching are the few cases when parents who consulted the oracle on matters related to childbirth would name their child after the god who had advised them or after the place of the oracle.
Given all these factors and trends, it's perhaps easy to understand why the literal names of heroes were not commonly used as names, even if there were no strict rules or moral taboos against them. There wouldn't have been any family tradition to do so; there was no social credit in making pretentious references; since mythological figures were not always the recipients of cults, they wouldn't often have been credited for advice or protection in childbirth. It's possible that their names would have been regarded as old-fashioned or an ill omen, given the fates of most of them. According to the searchable part of the Lexicon, Ikaros is attested just 20 times; Narkissos a more respectable 74 times. I can't find a single person named Odysseus. Only the hero Iason has a famous "real-life" counterpart in the 4th-century Thessalian tyrant Iason of Pherai.
Source for most of this: R. Parker, 'Theophoric names and the history of Greek religion', in S. Hornblower/E. Matthews (eds.) Greek Personal Names: Their Value as Evidence (2000), 53-79
I have a (hopefully) up-to-snuff answer for this one.
A quick bit of background first: Ancient Greek names were commonly made up of two parts: a given name, and a patronym. In some cases a third part was added, denoting ethnicity or locality of birth. Given names were frequently dithematic (made up of two parts), for example "Socrates", from "sos" (σως), "unwounded or safe", and "kratos" (κρατος), "power". This is very common among Ancient Greek names. "Philippos", "lover of horses", etc. Patronyms were derived from the individual's father.
Names derived from gods and goddesses ("Theophoric", or "god-carrying" names)were fairly common. For example, derivations of "Dionysos" were common among both men and women. So too were names like "Apollodotos", "given by Apollo" (think, "god's gift" sort of thing). Gods associated with the underworld and death were not used, or at least not frequently (no "Hades", "Persephone", etc.), likely because they were thought to be cursed or unlucky.
Simple nouns were another popular source of names. These can run the range from basically descriptive to outright insulting-sounding. The word "aischros", "ugly", is the source of at least twenty known names, and is the basis for the name of the tragedian "Aischylos", better known in the Latin form as "Aeschylus". Parts of the body, traits, colors, etc. were all used in these simple names ("Kephalos", from the word for "head", "Euthyphro" of Platonic dialogue fame, from "εὐθῠ́ς", meaning "direct"). Animal-based names were also common ("Moschos", derived from the word for "heifer"). A personal favorite is Kopreus ("shitty"). The supposition is that a lot of these names are derived from affectionate nicknames for kids that continued on into adulthood and thus entered the historical record.
The names you are asking about, though, are heroic names (those associated with great heroes). "Hercules" (the Latin form of the Greek "Heracles", from the name of the goddess Hera, who despised him because he was the product of a union between her husband Zeus and a mortal woman), Icarus, Odysseus, etc. were not popular in Classical Greece. The etymology of some of these names is disputed or unknown, and some of them (Odysseus, for example, the derivation of which is disputed, but associated in scholarship with words meaning "to wail", "to be wrought against", etc.) have a decidedly dark turn. Not to say they were never used, but they weren't common in the Classical or Hellenic periods. Why is unclear. Perhaps it was considered too great a burden to name a child after someone who was so revered. However, after the Roman conquest of Greece a taste for Heroic naming arose and continued until Christianity became mainstream. At that point biblical names began to be more popular.
See:
Parker, 2000 (in the volume listed below): https://www.britac.ac.uk/pubs/proc/files/104p053.pdf
Hornblower and Matthews (eds.), 2000 (for a broader discussion of the topic): https://www.britac.ac.uk/pubs/proc/volumes/pba104.html
The absolute definitive work on this subject is the voluminous "Lexicon of Greek Personal Names", started by the Oxford classisist P.M. Fraser and still undergoing revision.
Hello everyone,
If you're a regular, you know how this subreddit works. If you are a first time or infrequent visitor, please take a moment to familiarize yourself with the rules here. We have high expectations for responses here, and we will remove comments which don't comply with them. If you have questions or comments about this policy, please do not add to the removed comments already existing in this thread. We are happy to answer polite inquiries to modmail, but consider all users forewarned about what we expect in a comment. If you post META commentary in this thread, it will be removed, and you may be further warned. /r/AskHistorians isn't for everyone, but that is just how we roll.
We know that you want an answer, and so do we! But it takes time for a good answer to be written. In the meantime, check out one of these venues where earlier content is highlighted including Twitter, the Sunday Digest, the Monthly "Best Of" feature, Facebook.
As a special treat, just because I'm amused at specifically how terrible every single comment so far has been, here is a screenshot of all the top level comments at the time of writing this. If that is what you want to see, this isn't the subreddit for you.
There are a lot of layers in your question and spanning multiple eras, I will try to answer the best, but I'm not a historian, I will answer more from the linguistics involved, and the mods may remove the post if it doesn't fit the community guidelines.
There are thousands of personal Greek names recorded, but most of them come from the period after the 5th century BC, because this is the start of Greek Classical era we are most familiar with and Ancient Greeks had writing to document them down. Note that I said 'most of them'. Some of them are discovered more relatively recently, and they are older than the Greek Classical era, from Mycenaean times, which added to the inventory. But we have a lot of blanks in Greek history when there is no writing involved:
Despite the obvious difficulty Ancient Greeks created for us to make sense of, it's from the last period mentioned we know the most about Ancient Greek personal names, because of how much writing we had. The decipherment of Linear B added more to the inventory, but we still already had an idea on Greek names before that. Ancient Greek names usually are:
But we also have:
I had to mention all this first before addressing your question:
We do have three legendary names recorded in not Greek, but Hittite tablets:
TL,DR: Some of them yes, some of them were plausible even though not recorded, some of them were non-Greek names so unlikely to have been used by Greeks, some were created later to explain unclear etymologies to Classical Greeks, but were unlikely to be used in real life.
Sources
Follow-up question: what were the generalized naming conventions in the region at that time period?