The 20-year-old, who had already won three bronze medals, had been sixth at the turn for home but chased down a tiring Chad le Clos and just beat a surging Chalmers to the wall to touch in 48.02 seconds.
South Africa's le Clos and Chalmers, who had also won the 200m freestyle title and was a member of Australia's 4x100m freestyle gold medal-winning team, were tied for second in 48.15.
Scott became the first Scottish gold medallist at the Gold Coast Aquatics Centre and said he was particularly pleased to have executed his race tactics to perfection.
Commonwealth Games
Blake suffers shock defeat as Simbine takes gold in 100m
09/04/2018 AT 12:35
"I'm speechless to be honest, and that doesn't happen often. The main thing there was to execute my own race," he said.
"In the 100 you've got some boys who were incredibly fast in the front in the first 50 metres, and worked it back on the second.
"I had to stick to what I'm good at, and that's bringing it home. So I stayed quite composed and let Chad go out, and then I tried to hunt him down. I'm very pleased with how I executed."
Chalmers, who is swimming in the 4x200m freestyle relay later on Sunday, said he had been battling a slight head cold but there was no fatigue and no excuses for his swim, where he never really looked in contention until the final few metres.
"I've got a bit of a head cold so that's the biggest thing I'm dealing with but you can't use that as an excuse either," Chalmers said. "I just wasn't fast enough."
Le Clos, who has two gold medals in the 50m and 200m butterfly already, said he was incredibly happy with his silver-medal finish, especially with the time.
"It was a PB (personal best) for me," the 25-year-old said. "I could see them swimming right next to me at the end which really pushed me.
"I may have over-reached at the end, but big props to Duncan."
Cameron McEvoy of Australia, who was the fastest qualifier, had turned marginally ahead of le Clos but was swum out of the medals in the final few strokes and finished fourth.
Commonwealth Games
Gemili pulls out of Commonwealth Games 100m final with injury
09/04/2018 AT 07:58
Commonwealth Games
Bolt targets sub 19-second 200m
03/08/2014 AT 20:33