It depends on whom you ask. Those who would gut the Second Amendment reply that it is to kill and maim and that it serves no "sporting" use and should be banned from private ownership. Many handgun aficionados primarily into self-defense concerns reply,"To save one from unexpected attack". They usually go on to say that the handgun is there because a more potent long gun often cannot be.
I submit that the purpose of the handgun is whatever you want it to be.
Unlike the fools (meant in the truest form of the word) who support "gun control", those with at least a basic grip on reality can differentiate between the unlawful taking of life to the regrettable, but justified use of lethal force in dire circumstances. I have no real complaint with the shooters who say that the handgun's purpose is to save its user from harm, but do vehemently oppose the thought that this is the only purpose.
Here are some examples of what I'm saying. Most here understand that John M. Browning's 1911 was originally conceived as a sidearm for the US military, the mounted horse soldier in particular. Does that mean that the gun's been limited to such? I think not. This is evidenced by its having been produced in target versions such as the National Match or Gold Cup. Other companies have offered target grade 1911 pistols as well. What might well be called a "battle pistol" in its original inventor's intent still serves in the self-defense arena but has also earned favor as a target and recreational piece. Not all owners of the grand 1911-pattern pistol necessarily see its purpose as being but one-in-the-same with everyone else's view.
This S&W Model 41 in .22lr was designed primarily as a competition target arm. This one has never competed in a single match and probably never will. It definitely has served to reinforce basic shooting fundamentals and has also taken more than a few head of small game for the table.
Looking at it from the other direction, Smith and Wesson introduced the Model 29 .44 Magnum revolver primarily as a hunter's handgun, but to a limited degree some law enforcement officers embraced it as the ultimate combat sidearm. While most might not be able to handle it in defensive shooting scenarios, for those who could, the gun served that purpose.
Some prefer the challenge of bow hunting to using the traditional rifle. Others prefer the handgun for the same reason. I am one of the latter. I do agree that the large magnum revolvers are probably the best choices for these purposes, but here in Texas whitetail deer are not as large as in other states, particularly up north. Despite the protestations of some, I've found hot 9mm's, .38 Super, and .45 ACP to work fine so long as ranges are kept short (under about 40 yards for me) and only good shots are taken. This is not illegal in Texas and I will keep doing this so long as I can continue getting one-shot kills that are quick and humane. I doubt that John Browning envisioned the "purpose" of his battle pistols to be hunting deer and lessor four-legged critters.
S&W's line of Airweight snubs are called "Saturday Night Specials" by the gun-grabbers while many within the shooting community see them primarily as defensive arms or backup guns. That they can also serve to apply a coup de grace in the hunting field is frequently overlooked. They can also just be plain fun plinking guns. You decide. Any firearm's "purpose" can be change with the immediate needs or desires of the shooter. The vast majority of handguns can serve more than one purpose.
What I'm suggesting strongly is that you decide the purpose of your handguns. None of us can live the other's life. Perhaps we should not decree our purposes as the only valid ones? Perhaps we should let the individual shooter make his own decisions on this topic? Perhaps we should treat others as we would like to be treated in this regard?
As I said earlier, "The purpose of the handgun is whatever you want it to be."