You recieve 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.
You can get it after you defeat Cheren at Twist Mountain. Alder, (You meet him earlier in the game) will give you this after the battle. Twist Mountain is on Route 7, and you meet Cheren there after you get the Jet Badge.