Apparently the very first d20 was made in Ptolemaic Egypt.
What's really cool is how similar it is to modern d20s, shapewise. It just goes to show the universality of mathematics: it's pretty much the only branch of knowledge that's completely free of social construct. The symbols and the way we write the numbers are social constructs, sure, but the underlying principles are the same. And apparently, the icosahedron is the simplest way to render an object with 20 sides of equal shape and size. (Because there's so little in the way of social construct, xenobiologists are suggesting that in any first contact scenario with an alien race, we'll likely be "speaking" math until we can figure out each others' manner of communication and then the languages therein.)
The only real differences, of course, are that it's not made of plastic like our dice, and it's not quite as balanced as our dice, and obviously the characters on the dice. They didn't have Arabic numerals or a place value system in Ptolemaic Egypt; they didn't even have Roman numerals. The characters are instead from the Greek numeral system which, like the Roman, used letters to represent numbers. However, looking on the faces, it's a scattershot of different numbers, with values ranging from 1 to possibly even 1000, if I'm reading the cursive right and that is indeed a sampi. (It could also be a localized, demotic-influenced alpha, as this was Ptolemaic Egypt.) So whatever game they were playing with this, they either didn't need a 1-20 numbering system, or the Greek letters didn't stand for numbers.
Possibly they decided to create a new number system just for the game, which would not be the first time that happened with Greek numerals. (Hipparchus did this with a base-60 numeral system derived from the Babylonians.) Writing two symbols on each face might have been prohibitively difficult, but the iota alpha on the dodecahedron below belies that, and if it was 1-20 it would not have been difficult to represent that, as the iota (looks like an "I") stands for "10." Or, the sampi might have been the "critical hit." Having symbols from 1-10 and 20-90 and then a 1000 out of nowhere seems a particularly strong way to get the point across. These might have been some early sort of percentile dice. And even if that's not a sampi, similar dice have a tau on them, which stands for 300.
What I would have to reason is the most probable theory, though, is that the symbols represent the numbers they seem to, and they were used in a game of chance. If you're gambling money, it seems like the game would be more exciting if, with the possibility to win small amounts, you also had the very small chance of winning a huge amount. The sampi could be the jackpot, and the tau a smaller but still substantial jackpot. Or, it could also be that the tau is a poor man's variant, where the jackpot is smaller (only 300 of whichever coin, which, looking at ancient Greek currency, was probably an obol or chalkoi, as 24 chalkoi would be half a drachma, or enough to support a family for a day, and betting 300 of those would be within the reach of the average worker). I doubt they played role-playing games in ancient Greece; most people were not given a liberal education, but what would now be called vocational schooling. Their imaginations would have been mostly limited to their trades, and their games would have revolved around gambling or games of physical skill. Dice have little to do with racing or wrestling, so their use in gambling seems the most straightforward explanation.
This piqued my curiosity, so I did a Google search and found that Wired had a related article about an auction of a glass Roman d20. Evidently they couldn't identify the symbols on the dice, which is funny because they're the exact same symbols, down to the cursive zeta and everything. (I'm pretty sure that loopy Z-looking thing is a zeta, simply because they'd have had to figure out a simple way to distinguish it from a nu, the same way dice manufacturers now print lines or dots under 6s and 9s so we can tell them apart. Making flourishes that presage the later development of zeta's representation in Byzantine Greek cursive seems both a logical explanation for WTF it is, and a smart and pretty way to distinguish on the part of the ancient designers.)
But because we've found more or less the same sorts of dice with the same sorts of symbols 500 years apart, we can conclude that whatever dice game it was, it stayed popular for a good long time. The enduring Greek symbols on both the Greek and Roman dies suggest that it was associated with the Greek diaspora throughout the Mediterranean and Black Seas, and then later with the Roman elite that spoke Greek and not "vulgar" Latin. Especially if the Roman die was made of glass (and not bone), it was probably used by patricians that could have very well tossed away a thousand denarii at a single throw. The game therefore probably died with Greco-Roman civilization, around or shortly after the fall of the Western Roman Empire. After all, if it only survived with the Roman elite, then the death of that elite would doom the game too. Dice games did survive the Empire, of course, but they were the simpler games of 6-sided bone dice, with the numbers denominated by dots on each side.
In any case, it's an interesting thing to consider. Gambling with dice is still something we do today. I remember drinking at the Fave (something I wouldn't generally recommend unless you're a fan of hicks and/or violence) and gambling with dice with the people there. I won something like thirty dollars, but that's mostly because I was either smart enough or not drunk enough to calculate probabilities in my head on the fly, and bet accordingly. (My competition being sloshed probably helped a bunch.) In that case, we used six-sided dice, because polyhedral dice have been socially constructed as a tool of geeks. But in ancient times, they were almost certainly doing the same thing, drinking and gambling, but using icosahedrons and dodecahedrons as well as the hexahedrons we're used to.