HM03, or surf, is located in Wally's house next door to the Petalburg City Gym in Pokemon Ruby. A Hidden Machine, or HM, grants new powers to a Pokemon.
Unlike Technical Machines, or TMs, HMs grant powers that can be used outside battle. As with other HMs, the power that is granted is essential to being able to complete the game in full.
Once players are on Route 111 and have returned to Petalburg City, the next task is to battle all the trainers in the gym in no specific order and then then fight their own father in the final battle room. After the fight, players can go to Wally's house next door where they will receive HM03, or surf, when they talk to his father.