Madsen, claiming his maiden European Tour title, posted five birdies in his final-round 67 to finish on 19 under par, two shots ahead of South Africans Jbe Kruger (65) and Hennie Otto (68).
Their compatriot Schwartzel, the former Masters champion and tournament favourite, was at the top of the leaderboard by a shot at the start of the day and had a three-shot lead at one point, but ended fourth on 16 under after a 71, alongside Italy's Marco Crespi (70).
Madsen told www.europeantour.com: "It's been an amazing day. I don't really know right now (how I feel). It's kind of cliched to say it hasn't really sunk in, but it really hasn't.
"I'm just over the moon. I'm so happy. I mean coming down here, I expected to play well but I didn't expect to stand here...right now, that's for sure."
On Schwartzel, Madsen added: "I definitely felt like I could still win, but he looked like he was going to go off and I was just trying to hang on and maybe stay in two or three shots and give myself a chance.
"I had a great back nine but unfortunately for him he struggled. On a couple of holes he had some bad breaks. Luckily for me I was there to capitalise and I did with some nice birdies down the stretch."
Schwartzel birdied the second, third and fourth to go three clear on 18 under before dropping three shots on the sixth.
He double-bogeyed the 10th to drop further back, but then made three birdies, although it was not enough to challenge for victory.
Otto experienced a major slump, having led by four shots with four holes to play after three straight birdies.
He bogeyed the 15th and double bogeyed the 16th to slip out of contention.