A werewolf (or indeed any form of lycanthrope) has zero control over whether its bite can pass along the 'curse of lycanthropy'. Once someone has sustained damage from a "bite" attack roll (indicating that they've been bitten by a cursed creature) they roll for injury and an unsuccessful roll will indicate that they've been infected by the curse. The DM can then decide what the result of that exposure will be.
Bite (Wolf or Hybrid Form Only). Melee Weapon Attack:
+4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing
damage.
If the target is a humanoid, it must succeed on a
DC 12 Constitution saving throw or be cursed with werewolf
lycanthropy.
DND Basic Rules V1.0 - 2018
That being said, if the werewolf is voluntarily transformed, it can choose whether to use this additional bite attack or not. If the werewolf is involuntarily transformed (as a result of exposure to moonlight) it has no control over its actions, being controlled by its baser instincts.
You may want to note that other kinds of lycanthrope are more selective in their attacks, avoiding biting things due to the danger that they'll pass along the curse of lycanthropy to other creatures.
When a werebear transforms, it grows to enormous size, lashing out
with weapons or claws. It fights with the ferocity of a bear, though
even in its bestial forms, it avoids biting so as to not pass on its
curse. Typically, a were bear passes on its lycanthropy only to chosen
companions or apprentices, spending the time that follows helping the
new lycanthrope accept the curse in order to control it.
...
Weretigers grow to enormous size in animal and hybrid form, but they fight
in their more refined humanoid form when they can.
They don't like to pass on their curse, because every
new were tiger means competition for territory and prey.
Monster Manual - Core Rulebook
You may also want to note that in the world of Dungeons and Dragons, were-creatures carry a curse that affects their physiology and alignment but they're not the undead. If you get the werewolf curse during a fight but are then reduced to 0HP (during the same fight or subsequently), the curse doesn't keep you artificially (un)alive. You're just dead.
It reverts to its true form if it dies.
Monster Manual - Core Rulebook