1. Defeat the Olivine City Gym Leader.
To get the Surf HM in Pokémon HeartGold and SoulSilver, you must first defeat Jasmine, the Olivine City Gym Leader. Jasmine is a Steel-type Gym Leader, so bring Pokémon strong against Steel-types, such as Fighting, Ground, and Fire-type Pokémon.
2. Return to Professor Elm's Laboratory in New Bark Town.
After defeating Jasmine, return to Professor Elm's Laboratory in New Bark Town. Professor Elm is located on the north side of town.
3. Talk to Professor Elm.
When you talk to Professor Elm, he will give you the Surf HM. The Surf HM can be used to teach the Surf move to your Pokémon.
4. Teach Surf to one of your Pokémon.
To teach Surf to one of your Pokémon, open your Bag and select the HM section. Then, choose Surf from the list of HMs and select the Pokémon you want to learn the move.
> - *Note:* some Pokémon won't be able to learn Surf naturally due to their typing. Some Pokémon who can't learn Surf but you might have on hand are: Octillery, Quagsire, Azumarill, and Starmie.
5. Use Surf to cross water.
Once Surf has been taught to one of your Pokémon, you can use it to cross water. To use Surf, simply select it from your Pokémon's list of moves when you are standing next to a body of water.