Hit dice (HD) are the number of dice rolled to generate the hit point total. In other words, HD is equal to a creature's level.
Each time a character or creature levels up (gains a level), the hit dice are rolled, and the resulting number is added to the character's (or creature's) total hit points. For example, a third level dwarf fighter 3 has 40 hit points; the fighter HD is 1d10, and 19 CON (short for CONstitution). At level 1, the dwarf had 10 hit points; since the dwarf's CON modifier is +4, 4 HP are added to the hit points gained. At level two, the hit dice roll was 8, plus another 4 from the CON modifier, bringing the total HP to 26. The dwarf leveled up again, and the hit dice rolled a 10, with another four from the CON modifier; the grand total is 40 hit points. The dice roll may be random, but the number of hit points gained from the CON modifier will always equal the constitution modifier.
Some creatures and monsters do not level up, but instead are set at a predetermined level (See Challenge rating). The number of hit dice that are rolled is equal to how many levels the monster has. For example, a level 6 dire ant (not an actual creature) uses an 8-sided die in its dice roll for HP. The ant's hit dice would be represented as 6d8 - six eight-sided dice are thrown, or, to think of it another way, the eight-sided die is rolled six times. The 'd' can be thought of as a multiplication sign.