So I was thinking about this story for a run where the players must catch a target who, according to the Johnson, turned his weapon against him. So I want my players to be chasing this hacker/technomancer but I wonder if I can explain it with the rules. So if a hacker/technomancer would have the right echo, could he hack a weapon in contact with his temple or really close to his body? What do I need to do with the NPC to make this story work (if possible)?
First thing first, this is not specific to technomancers at all. Any kind of hacker (technomancer or not) can hack a gun in more or less the same way.
Second: the only way to have the gun physically turn on its user would be if the gun was able to move. As per Arsenal, there are modifications to make the gun able to crawl or even fly. A hacked gun then would be able to move itself toward its owner, and shoot at him. Note however the hacker would be limited to guns modified in that specific way, which is pretty rare overall.
Alternatively, and since we are talking about an NPC, you could go on the target selection track. A smartlink aids the user in targeting his enemies, and in some cases helps him not hitting his allies. A hack inversing these selections could be... interesting. (Again, note that a hacker and a technomancer would have the same options here.)
The only way for someone to actually turn the gun back on someone would be to force it back upon him physically.
It's possible for any weapon running with a wireless Smartlink to be hacked, which allows the hacker to control any of the smartgun features (ammo skip, eject clip, fire the weapon, and a handful of other interesting things); but this doesn't necessarily equate to turning the weapon back on its owner.
Basically, if the user is a total novice, and actually puts the gun to his own head, or points it toward himself or an ally, the hacker can get a kill, but it's partly luck (I'd use the suppression fire rules for against an ally, and they'd have to be pretty stupid to get a bullet from their own gun).
The only other possible way to cause a gun user to suffer on account of his own smartlink would be to cause a weapon malfunction, but with modern automatics that shouldn't be possible; the only way to cycle the weapon is to chamber the next round, which permits the bullet to be shot, chambering the next round. With a revolver, or something like a single-shot weapon, you might be able to induce a misfire, but rarely would this lead to a firearm explosion.
In your specific situation - a Mr. Johnson getting shot by his own gun - yes, it's certainly possible. There's plenty of opportunity for a patient Hacker (techno or commlink based) to get control of a smartgun, then wait for the right moment to fire - perhaps when Mr. Johnson was about to clean it or similar. A hacker can cause the weapon to fire, but cannot point it in any specific direction.
In a combat-situation, things are much harder, as other answers have correctly pointed-out.
Lastly, there's PLENTY of other havok that a hacker could cause to a target that could be much, much worse than a gunshot - controlling Mr. J's car, or locking him in his house. Something like that might make for a better plot-point than a gunshot.
Actually a cyberarm is usually slaved to one's comlink, which allow receiving live status (damage taken, etc...) and remote control by a doctor. Hacking one's PAN hence allow controlling his cyberware, if he or she didn't suppress the wireless function (which any good runner should do).
Second, there is an echo for technomancer in the Unwired addon which allow to control machine by contact, even if the device isn't supposed to be remote controlled. Your NPC could use it to control a cyber arm or weapon by touching it.