You receive the HM surf after defeating Cheren at Twist Mountain. You get it from Alder, a Champion in the Unova region, as he congratulates you for the nice battle. After you listen to him talking to Cheren about the "stronger" conversation, he will give Cheren a HM03. And he will say "Here-you too." and give you HM03-Surf.