Media playback is not supported on this device
Williams signed a permanent deal on Wednesday, having won six of his ten League One games since being given the job on an interim basis in December.
The 35-year-old joined the Robins as first-team coach in 2013, but has no previous managerial experience.
"I'm really pleased because it's huge backing from the chairman," he told BBC Wiltshire.
"It's quite out of the blue. I'm sure the chairman spent a long time considering everything and only brought it to my attention when he was absolutely sure of what direction he wanted to go in, so it was a pleasant surprise."
Swindon are 13th in the League One table, seven points outside the play-off places.
New Swindon head coach Luke Williams says he was surprised to be given a five-year contract with the Robins.