He doesn't understand.
then just tell him to leave you alone
By smacking him he learns the behavior is inappropriate and stops it.
Bitchslapping is a great way of teaching people.
Yes, but I'd consider it a last resort. There's no reason to slap someone (especially a 5 year old, who might not understand what he's doing is pissing you off) right out of the blue when you can simply try asking them to stop.