In this case, %.0s always prints one instance of character(s) preceding it, HH in this case. When you use {1..5000}, the shell expands it and it becomes:
printf 'H%.0s' 1 2 3 4 ... 5000 > H.txt
i.e., the printf command now has 5000 arguments, and for each argument, you will get one H. These don't have to be sequential or numeric:
printf 'H%.0s' a bc fg 12 34
prints HHHHH -- i.e., the number of arguments, 5 in this case.
Note, the ellipses in the 1st example above aren't inserted literally, they're there to indicate a sequence or range.