Cynthia's grandmother gives you it after the bomb scare, which is after the Psyducks-ness. You need the SecretPotion to cure the Psyducks. You get that from Cynthia after you battle the Galactic Member you're supposed to stalk from Pastoria (The location you get the the SecretPotion is at the Valor Lakefront).
You find HM Surf, you first need to beat Wake the Water Gym leader and then get Surf in the same city you beat him in. To move the Psyducks you need to first talk to that Galactic Member in Pastoria City. Keep on following him and then when you finally beat him Cynthia will come to you right away and will give you the Secret Potion to move the Psyducks.