Hansen triumphed with a total of 27 points, with Bryan Coquard of France second on 29.
Great Britain's Ed Clancy, the 2010 world Omnium champion, finished with 30 to take bronze, while world champion Glenn O'Shea of Australia was back in fifth on 34.
Hansen's success was all the more remarkable given he was sent tumbling in the early stages of the 15km scratch race after touching Kenny's back wheel.
He believes that setback ultimately proved a blessing in disguise as he recovered well from the fall to finish sixth and then took second place in the closing 1km time-trial.
I just got mad and wanted it even more. I just took my chance and went flat out until I could see the medal hanging there.Lasse Hansen
'My goal was just to do good. I'd have been really happy to get any medal so standing here with a gold medal is a crazy feeling,' he said.
'[The crash] makes this feeling even more crazy. It gave me some extra power, an adrenaline kick.
'I just got mad and wanted it even more. I just took my chance and went flat out until I could see the medal hanging there.'