It's sometimes possible for a dentist to accidentally hit a nerve with a needle when giving you an injection but it's very rare that a dentist does hit a nerve when giving you the numbing injection.
The needles that the dentist uses to give you the numbing injection are small and tiny enough to where they will be very unlikely to hit a nerve.
The dentist will be very careful when giving you the injection but sometimes it can happen because after all the dentist is human just like us.
So mistakes can happen no matter how professional you are.
If the dentist does hit a never you sometimes can tell by the experience of A sharp, stabbing pain or ache radiates from your teeth for a few seconds.
If you think the dentist hit a nerve you should tell them but no harm should be done and it should heal itself within a few days.