Dong, the 2008 bronze medallist, outshone team-mate and defending Olympic and world champion Lu Chunlong to score 62.990 and take the gold, finishing 1.221 marks ahead of Russia's Dmitry Ushakov in silver-medal position with Lu taking bronze.
Canada's MacLennan saw off the challenge of defending champion He, who lost control at the end of her routine to win bronze, with team-mate Huang Shanshan taking silver.
MacLennan scored 57.305 in the final, 0.575 marks clear of Huang, with favourite He 1.355 marks back.
'I'm pretty happy, I did a good performance,' MacLennan said after collecting her gold medal.
'I always believed that everything was possible, but I was just focusing on my routines. I didn't want to get ahead of myself, because that's when you make mistakes.
'This was definitely the highest score I've ever gotten, but I didn't want to get ahead of myself before the Chinese had to compete.
'Nothing matches that experience. It has not fully sunk in yet.'
Dong claimed gold thanks to breathtaking sky-high routine and revealed he has been mentally preparing for the Olympics in a special way.
He said: 'I've been looking forward to the competition.
'Just before the Olympics I wrote in a journal everyday and told myself I would do my best in the Games. 'It was one of my dreams to win this medal and I'm happy that the greatest moment has come.'