Hello. Welcome to Just Answer.
Have you already tried resetting the circuit breaker?
Was the nail in a wall stud?
If the nail has no arc marks on it, and the breaker held when you reset it, I don't think you have anything to worry about.
It could have been the vibration, causing a connection to make and break quickly in a box. That arcing can trip a breaker.
If there were outlets on that wall with items plugged in to them, you may have been causing some arcing with the pounding of the hammer.
Arcing at an outlet can cause a breaker to trip.
That may have been the cause. Hard to say without seeing it happen. But I wouldn't sweat it too much.
If the wire were damaged significantly, there are two possibilities as to what would have happened when you reset the breaker...
It wouldn't hold, and would continuously trip, OR
The circuit fed by that breaker would be partially or completely out, even with the breaker on.
I doubt you damaged it at all, unless the nail was pretty long.
The wire isn't typically close to the back side of the drywall you put hanging nails in.
In that case, I would not have trouble sleeping tonight.
Happy to help. Is there anything else I can do for you?