Italian striker Raffaele De Vita scored the only goal of the game 19 minutes from time, taking advantage of poor Bristol marking to head home unchallenged from seven yards out.
Paolo Di Canio's men were well worth their victory in this first round tie, finally taking place after being postponed following the riots across the country earlier this month, and dominated against a Bristol side who were lacklustre throughout.
The visitors should have gone in front after just five minutes when Leon Clarke got on the end of Callum Kennedy's cross, but his close-range effort was blocked by City defender Lewin Nyatanga.
Matt Ritchie should have done better with his chance two minutes later, but he scuffed his shot wide from six yards out.
The home side's best chance of the half came on the half-hour mark, when incisive midfield play saw striker Brett Pitman put through on goal, but he could only shoot wide of the post.
City flew out of the blocks in the second half, presumably after strong words from boss Keith Millen, and almost went in front immediately. Substitute Albert Adomah set up Neil Kilkenny, but his effort was well saved by Phil Smith in the Swindon goal.
But that was as good as it got for the home side and the Swindon fans were sent into raptures 20 minutes from time when slack marking from Bristol allowed De Vita to score the only goal of the game.
Experienced striker Jon Stead was sent on in response to the goal, yet it was Adomah who almost restored parity five minutes later, but his shot was parried by Smith.