It Is determined by the DM like everything else in the game.
Well, not everything. I mean, most games use some amount of material that’s prepared… monster stats, locations, traps, entire settings. I know all of that can potentially be changed if needed, but it’s still a starting point.
It is not really different from "this lock is has a 16 dc to pick".
Except that most often, no matter how I describe my approach to picking a lock, the DC will remain fixed. Players shouldn’t expect auto-success or auto-failure in most cases based on their description of the action. That’s a pretty big difference.
Also, people don't generally consider lock picking or trap disarming boring. A lot of times, they’re edge of your seat situations.
Only that the DC is more flexible based on the interaction the PCs are having with that NPC.
It is more complex, but also very subjective, because especially with smaller NPCs, the DM has to make up the Wants, Needs and personality traits of the NPC on the Spot. Like will this Guard be bribed? Is that Guard a bribable guard or a rare honest Guard?
You know what’s a good way to determine that so that the GM isn’t deciding everything? The dice!
And to feel fair to.the players, such traits should, if possible, be telegraphed how the NPC is portrayed be the DM.
This I absolutely agree with. I’ve played with GMs who treat every single NPC antagonist as some uber-devoted and loyal paragon in service to their cause or their lord.
But making an NPC actionable by the players is important, I think. They should be able to suss some info out, or at least try to, and leverage that. To me, far better if I’ve made an Insight check and so I know this guard isn’t open to a bribe, but is open to the idea of justice. I fI then tailor my plea to him accordingly, then I do so with advantage. Dice rolls, but not boring. Also, not done without narrating my approach. I don’t know why a dice roll has to happen in a vacuum.
That what makes social interactions complex. Because you can just set a DC 15 to all Guards to bribe and tell the players that's the DC for that because that would make the game stale and boring.
Why? I do this kind of thing all the time. I consider the location and then I think of its strongest defense, and its weakness. Then I decide what DCs to give those two ends, and anything else is in the middle. If the players have gathered some information on the location, they’ll know that the castle guards are very unlikely to be bribed, but are very scrupulous and may be convinced their master is in the wrong (or whatever the situation is). So bribery has a DC of 20 and appeals to justice or righteousness or good have a DC 13. That kind of approach makes the mechanics support the fictional situation.
If a roll doesn’t go the PCs way, that doesn’t have to mean they did a poor job of appealing to a guard’s good nature, it may mean they ran into one of the few SOB guards. No dissonance at all.
I start with a general idea, and then let the players’ actions and the dice determine the details.