Photo: Paul Crock/AFP
The 97th-ranked Sandgren downed ninth seeded Wawrinka 6-2, 6-1, 6-4 and will next play Germany's Maximilian Marterer.
It has been tough so far this year for Wawrinka, who was playing in his first tournament since Wimbledon six months ago following left knee surgery.
“Today was extremely tough to feel that way on the court, to lose that way, even if he was playing well,” Wawrinka said.
“When you have won three Grand Slams, you don't feel great on the court like today. But I need to be still positive. I think the last 12 days was more than what I could have dreamed for coming here.
“I really came without thinking I will be able to play the first match. That's a big step for me.
“I only had surgery five months and three days ago and to be that far already, it's more than what we could have expected with my team.”
He was never in the contest and had his serve broken five times and made only 21 winners and 35 unforced errors.
The three-time Grand Slam winner, who defeated Rafael Nadal to win the 2014 Australian Open, has slipped to nine in the world rankings and faces a battle to climb higher after his early round exit.
“My plan is to leave here and go back to practice, especially fitness-wise at the beginning,” Wawrinka said of his future plans.
“I know I have a lot of work to do. I need to be really patient. It's going to be tough. But I'm ready for it.”
Federer into third round
Meanwhile defending champion Roger Federer advanced to the third round for the 19th straight Australian Open with an easy win over Germany's Jan-Lennard Struff.
The Swiss second seed was too strong for the 55th-ranked Struff, reeling off a 6-4, 6-4, 7-6 (7/4) victory in 1hr 55min in the night match on Rod Laver Arena.
The 19-time Grand Slam champion will face Frenchman Richard Gasquet in the third round on Saturday.
“I knew about him going in. I've practised with him, played singles and doubles against him too so you have the information you need,” Federer said of his German opponent.
“You know he can serve 215-220 km/h no problem for five hours, that's what you are ready for and I knew he was going to go for his shots. So the focus was on me protecting my serve as well as I can and try to get a service break either by good defence or maybe he helps me out a little bit, and I think it was a bit of both.”
Federer improved his Australian Open record to 89-13.
The Swiss champ is coming off an extraordinary 2017, when he won a fifth Australian Open title and a record eighth at Wimbledon, after returning from an injury lay-off.
It was in Melbourne a year ago where he lit the fuse on his late-life tennis renaissance, beating Tomas Berdych, Kei Nishikori, Mischa Zverev and Stan Wawrinka before downing great rival Rafael Nadal in a five-set final classic.