The fly-half will join Warriors in the summer after agreeing a two-year contract.
The 20-year-old Scotland youth international has made 12 first-team appearances for Bath, who he joined in 2014.
Edinburgh-born Hastings said: “From a young age I wanted to play for Scotland and I believe playing in Scotland is the right decision for me at this stage of my career.
“As a young 10 it’s important to get game-time and hopefully I’ll get that opportunity in Glasgow.
“I’m excited about working under Dave Rennie as I’ve heard he is a world-class coach.
“There are some quality players in Glasgow and I can’t wait to get up there and start working with them.
“I like to run the ball, I’m quite an instinctive player and I like to have a crack. I like the way Finn (Russell) plays and I can’t wait to get up there and learn from him.
“Glasgow are flying at the moment, they’ve got a good thing going and seem to be a really tight-knit team.
“Qualifying for the quarter-finals in Europe was a big statement of where the club is going and I’m excited to be joining them next season.”
Warriors boss Gregor Townsend, who will take up his role as head coach of Scotland in the summer, added: “Adam trained with us a couple of years ago and he has really developed during his time at Bath, working with the likes of George Ford and Rhys Priestland.
“It’s great that he has decided to move back to Scotland and I’m sure he’ll fit in very well at Scotstoun next season.”