It's a Dungeons & Dragons convention
The "d" dice notation originates with Dungeons & Dragons, which innovated in the use of multiple types of polyhedral dice and often requires multiple such dice to be rolled at once. The frequency with which rolls are required necessitates a dice notation in order to present it in an abbreviated form. It dates back at least as far as 1977.
Dice notation did not appear in the original 1974 D&D box set, requiring writers to type it in full. For example:
Prior to the character selection by players it is necessary for the referee to roll three six-sided dice in order to rate each as to various abilities, and thus aid them in selecting a role.
In a 2013 article, RPG historian Jon Peterson traces it to the fanzine Alarums & Excursions, issue #1 (June 1975), in the article Dice as Random Number Generators by Ted Johnstone, an alias for writer David McDaniel:
It is the intent of this monograph to examine the statistical distribution of different numbers and combinations of the five types of dice available to us: 4-sided, 6-sided, 8-sided, 10-sided and 12-sided, referred to hereinafter for convenience's sake as D4, D6, D8, D10, and D12. [...]
To demonstrate this thesis in its simplest form, compare one D12 against two D6.
This illustrates the original meaning and purpose of dice notation:
- D-number (e.g. d8) is an abbreviation for the benefit of brevity in written form. Most gamers in 1977 were not mathematicians or computer programmers, and the Web did not exist for research. As such, they would not have been influenced by these concepts, and terms like "n-tuple" would have been unknown to them. Johnstone, or someone who influenced him, simply decided that "D-number" was a sufficient syntax.
- The syntax for multiple dice, e.g. 2d8, literally means two "d8"s. One eight-sided die is d8; 2d8 is literally two of them.
Use in D&D
The earliest instance of its use in D&D which I can find is Dragon Magazine #7 (June 1977), in the article What To Do When the Dog Eats Your Dice, by Omar Kwalish, an alias of the magazine's editor Tim Kask. The AD&D Monster Manual (1977) did not adopt dice notation, but the Player's Handbook (1978) officially introduced dice notation to the game's standard rules. For example:
The cleric has an eight-sided die (d8) per level to determine how many hit points (q.v.) he or she has.
Kask worked at TSR and was heavily involved in the development of AD&D 1st edition. It's unclear whether Kask introduced the term to D&D, or its appearance in Dragon #7 represents that a tendency already in use internally at TSR. We also know that Gygax read Alarums #1, and wrote a letter which was published in the second issue, though TSR didn't adopt the dice syntax for another two years.
The "d" is usually pronounced "dee", though there is a regional variant which pronounces it "die" (see “Dee-twenty” and “die-twenty” pronunciations on RPG Stack Exchange). It's certainly an abbreviation for "die" or "dice".
It's unclear whether or not "d8" was intended to represent an extant spoken form (e.g. "die 8"). The RPG community in 1977 was fragmented, and connected largely by regional word-of-mouth and fan-typed newsletters like Alarums & Excursions. What I do know is that reading "d" as "die" was actually practiced by a certain subset of gamers. We see this in some much later self-published works by Len Lakofka, an RPG writer from Chicago who was also an active fanzine author.
However, Gary Gygax was also connected to Lakofka via many of the same fanzines and groups. We might infer from the fact that Tim Kask speaks it as "dee" in his videos, and no TSR book that I'm aware of wrote "die", that TSR did not interpret it that way. I suspect that "D" was an abbreviation necessitated by limited pagecount of fanzines, and that "die 8" was a reading some groups made from the abbreviation.
If you're interested in more specific detail as to which exact individual coined the "d" notation and the circumstances of came to enter D&D, you might leave a comment on the current latest video on Tim Kask's YouTube channel. He frequently answers viewer questions on such matters.
Addendum
Some commenters have suggested that the XdX notation comes from a need to avoid ambiguity in cases such as "20d6", which if written "20 6D" could be misheard in speech as "26D". I disagree with the notion that this was the origin of the notation, for the following reasons:
- The problem only happens when rolling exactly twenty, thirty, or another multiple of ten dice. "19 6D" and "21 6D" aren't ambiguous in the way "20 6D" is.
- Rolls as high as 20 dice were almost unheard of in June 1975 when Johnstone defined the syntax. The only D&D books published at this point were the original boxed set and possibly the first printing of Greyhawk, which was brand new at the time (source) and first introduced rules for magic users of up to 20th level who would be capable of using twenty dice. There were no rules for 30th level characters. It was also common for characters to retire around level 14 when their high power levels meant the game was no longer sufficiently challenging.
- If you thought someone did say "roll 26D", it wouldn't make any sense anyway, because all other die rolls specify the die type. Twenty-six of what type?
- XdX notation actually creates a more common problem in this regard. 4d6 can be misheard as "forty-six"; similarly 6d6 as 66, 7d6 as 76, 8d6 as 86, and 9d6 as 96. Rolling four dice is considerably more common in D&D than rolling 20 dice.
- Considering why Johnstone (or whoever may have coined the syntax before him) selected XDX rather than X XD would only be speculation. While can certainly debate which format is superior or more sensible, the main reason that we use XdX notation is simply that it was adopted by TSR beginning with the Advanced Dungeons & Dragons 1st edition Player's Handbook (1978), and this work was so influential that it became standard in roleplaying games.