The myth says he killed the lion by putting the beast in a stranglehold and choking it to death, but how did he avoid being clawed and bitten by the lion while doing so?
Presumably, by "the lion", you are referring to the Nemean Lion.
The poet Theocritus addresses this precise issue in the 25th of his Idylls. In it, Heracles (whom the Romans called Hercules) is narrating to his friend Phyleus an account of how he vanquished this creature.
After Heracles had, in vain, shot at the beast with arrows, the vexed animal furiously charged at the hero, who in turn took the raw olive-wood club he had brought from Mt Helicon and bashed the lion on the head as hard as he could, thus inadvertently smashing the club to pieces. The lion's head was dizzied by the darkness swimming in its eyes "at the stunning shock to the brain's core" and the monster drooped as its feet trembled. Heracles goes on to tell Phyleus:
Seeing him [the lion] witless with whelming pain, before he could turn and breathe again, I was quick to advance and seize him by the scruff of his iron neck, having thrown my bow to the ground with my embroidered quiver. Then I throttled him mightily with my stout hands, reaching round from behind lest he lacerate my flesh with his claws. I set solidly my heels on his hind feet and pressed them down to the ground—my knees took care of his sides—until I raised his body up breathless in my arms and stretched it out.
The lion then died instantly.
In other accounts Heracles cornered the beast in its own den, a cave with two openings, one of which cave-mouths Heracles blocked up, after which he somehow gained the advantage over his opponent to fight against it better in these close quarters rather than out in the open, such as in Theocritus. These accounts are nowhere near as detailed as that in Idyll 25, all saying simply that Heracles strangled the life out of this lion.
I think it safe to assume that at least two factors worked in the hero's favour, the foremost of which is that, since Heracles' strength was so prodigious, it was a significantly easier task for him to perform safely than it would have been for a more ordinary man.
Considering how Heracles fared against gods and giants, who may have been much larger and some of whom certainly were way more powerful than this lion, Heracles was probably several times stronger than this beast, and it may have been for him, by my guess, like handling a rag doll (aside from certain dangerous features of the like that you reference, i.e. its razor-sharp claws and teeth).
In his Thebaid, Statius seems to imply that Heracles' body itself was so strong that he "broke" the lion "against the strong pressure of his breast and... upon his own bones." (Meaning he broke the lion's bones or some other part[s] of its body, or rather speaking more figuratively?)
The other factor, to augment the first, is that Heracles is supposed to have been a highly skilled wrestler, this idea coming from the assertion that he had received expert training in this discipline from a certain son of Hermes, either Autolycus (according to Apollodorus) or Harpalycus (according to Theocritus), the latter of whom "no man could abide confidently in the ring even so much as to look upon him from aloof: so dread and horrible was the frown that sat on his grim visage."
Some Loss and Some Assistance
Notwithstanding the above, there is a later writer named Ptolemy Hephaestion who in his New History, takes up the Question's concern, telling us that Heracles lost one of his fingers in the fight against the Nemean Lion, so while he neither died nor, so far as we are informed, sustained further injury, he did not leave this battlefield fully unscathed. It is noteworthy that he seems to have learned from the experience, thereafter using the lion's own pelt to protect his body from further harm.
Ptolemy uses the episode of Heracles' maiming as an aetiology (origin story) of particular burial practices, one of which is carried down for centuries afterwards in parts of Western European culture.
Heracles, after the Nemean Lion had bitten off one of his fingers, had only nine... [T]here exists a tomb erected for this detached finger... [O]ne can see at Sparta a stone lion erected on the tomb of the finger and which is the symbol of the power of the hero. It is since then that stone lions have likewise been erected on the tombs of other important people. Other authors give different explications of the lion statues.
As a bonus miscellaneum, Ptolemy adds that, according to Alexander of Mindos, there was an Earth-born serpent which fought with Heracles against the Nemean Lion. As with many other offspring of Gaia, the Earth, this snake was probably huge, and should have made for a good wrestling tag-team member that Heracles could have used as a kind of rope without having to make any lethal contact with the monster lion.
Every piece of artwork that I have seen, that is at least 500 years old, portraying the contest with the Nemean Lion, depicts Heracles tussling with the beast while he is completely in the nude. (In virtually every ancient vase painting of the scene, his groin dangles precariously close to the lion's snout.) Considering the concern raised by you, as well as by Heracles himself in the Idylls, this seems simply absurd, but it is probably merely a form of stylisation.
Prior to this, Heracles had only ever fought one battle, against the Orchomenians, at which he was outfitted by Hephaestus, the metalworker of the gods, with a golden breastplate. The fight with the Nemean Lion is the only other battle in which he would have needed this piece of protection since he hereafter wears the lion-skin as armour. It would make sense that he wore the breastplate in the struggle against the lion, which of course would have guarded only part of his body.
Beyond these speculations, and the hero's own quite detailed report in Theocritus, we can only imagine that Heracles was altogether so lucky or simply that good an animal-wrangler.
There was a RL case of an explorer attacked by a (provoked) leopard, and strangling the leopard with his bare hands. Granted this was a leopard, not a lion; but neither was the explorer Heracles, so I suppose you could call it a "scaled down" equivalent. Carl Akeley describes his fight in detail here. He did not strangle the beast from behind, but ended up kneeling on its armpits, as he describes, staying out of the reach of the hind legs. Then he actually throttled the leopard, unlike Hercules in the Theocritus account, who appears to have actually broken the lion's back or neck. Seeing as the general consensus is that Heracles strangled the lion, perhaps the Akeley account is closer to the mark.