So you are referring to
The character also regains spent Hit Dice, up to a number of dice equal to half of the character's total number of them. For example, if a character has eight Hit Dice, he or she can regain four spent Hit Dice upon finishing a long rest. (PH, 186)
this is talking about gaining back hit dice that you have "spent" to heal yourself during a short rest
A character can spend one or more Hit Dice at the end of a short rest, up to the character's maximum number of Hit Dice, which is equal to the character's level. (PH, 186)
These hit dice are the 1d6, 1d8, 1d10, or 1d12 you roll to gain hit points each time you go up a level in a class. So the max amount of Hit Dice you can have at any given time is limited to 20, as you cannot go past level twenty. This is going based off of the advancement chart on page 15 of the PH, meaning the sum total of your levels cannot pass 20, even if you multiclass. However, your DM may allow you to keep gaining hit points, and thus hit dice, beyond level 20.