If this is Soul Silver he automatically gives it too you after you defeat archer and thus disband team rocket. This happens after you have beaten the 7th Gym and gone to Goldenrod city and defeat team Rocket there and battle your way up the Goldenrod radio station.
If this is Heartgold then only the guy in Pewter city gives it too you.