This could fit in the definition of HP damage, but it is up to the DM as to whether it should at their table.
5e does not have locational damage
D&D 5e does not have locational damage or called shots, so allowing damage to be done to the testicles in particular would be opening the door to problems with future called shots issues. See this Q&A for more.
What this means for this case is that so stabbing someone is stabbing someone and it does damage if the attack says it does. Stomping on someone is stomping on someone and, if the attack/DM says so, it will do general HP damage no matter narratively where it is placed.
Hit points can do this
Hit Points represent much more than just just the ability to continue physically living or to "fight or flee":
Hit points represent a combination of physical and mental durability, the will to live, and luck. (PHB 196)
Thus, it is entirely possible that this kind of treatment could be argued to reduce hit points. Torture especially could be argued to reduce "mental durability" and "the will to live".
However, there is nothing in the rules that say that torture or testicle stomping has to or even should reduce HP. More precisely, there is nothing in the rules that forces stomping on testicles as part of torture to be considered an attack necessarily. In this case that the potential damage was done slowly and part of another process just makes it further removed from normal attack rules. Thus, this is just going to have to be a DM call.
There are many ways to run this scenario and not all involve damage at all
There are many ways a DM could choose to run such a scenario and many of the ways don't require battle mechanics (attack, damage, etc.) at all.
Since this is an NPC as you say, I could easily see torture being simulated by ability checks or saves instead of damage. They could also be played as completely narrative with no rolls involved. There are probably other methods that could also work. Since the game doesn't have any mechanics for it is must fall to the DM to decide.