The idea is that Hal and Harry are both short for Henry. But to be honest I've never come across this contraction anywhere other than in reference to English kings (not that I've known many Henrys irl). In my mind, Harry is normally short for Harold.
Hal/Harry wasn't Shakespeare's invention - Henry is also called Harry in the earlier Famous Victories, and Henry VIII was certainly nicknamed Harry ("Harry our king is hunting for to bring his stag to bay", etc.). But when did that contraction for Henry come in? And when (if it has) did it die out?
I've not looked into the matter, but it occurs to me that it would be kind of cool if the usage derived from Henry V himself, who was the first king to make a concerted effort to move court language from French to English. Given that Henry is a quintessentially French name, might he have been tempted to connect it to a quintessentially English one - i.e. Harold?