Gandalf wasn't surprised because he was the one who sent Sam on the whole journey with Frodo in the first place! he made sam promise not to leave frodo, so why in the heck would he be surprised if he knew sam had to have been with frodo...some things in movies are just so confusing