For many people, Daenerys barbecuing King's Landing was the most shocking part of the most recent episode of Game of Thrones. Seemingly out of character for her, people were not happy to see it. Once you start thinking about it however, the signs are there, and most of it is Tyrion's fault.
We saw pretty quickly Daenerys could take King's Landing easily with just Drogon. Fly straight to the Red Keep, burn a few soldiers if you need to, take out Cersei, job done. Handy out. No civilian casualties. Since the beginning of season 7, Tyrion has been telling Daenerys to wait. Stay, and avoid civilian casualties. Since Dany arrived at Dragonstone, there's been a lot of bad things to happen to her, pretty much solely due to waiting around.
- Lost two dragons because Qyburn had time to build a weapon
- Lost Missandei and Jorah, two of her closest friends and advisors
- Lost half her army
- Betrayed by Varys
- Found out Jon has a better claim to the throne than her
Losing her advisors and people she trusts most, as well as her dragons, was always going to have an impact on her mental health. Had Dany gone straight to King's Landing, so much bloodshed would've been avoided.
This coupled with who Daenerys is as a person, led to her madness. She has always had a violent, ruthless streak in her. She is motivated by a desire for revenge and a thwarted sense of entitlement. This is the woman who thrilled to hear Drogo announce he would "take my Khalasar west to where the world ends" to "rape their women, take their children as slaves and bring their broken gods back to Vaes Dothrak."
This is the same woman who swore to the leaders of Qarth that, "when my dragons are grown, we will take back what was stolen from me and destroy those who have wronged me! We will lay waste to armies and burn cities to the ground! "
Much of the audience gave her a free pass for her cruelty, because many of the people she burned alive were not decent people, slavers for example. Then you think, Mirri Maaz Duur, who was killed because she took revenge on the Dothraki for killing her family and raping her. Then you think of the Tarlys (Sam's father and brother) whos only crime was being skeptical of a foreign invader. Also, the fact she is a young, beautiful, woman helped her too.
Daenerys has a massive ego, and when the people of King's Landing didn't flock to her, and revolt against Cersei, it affected her deeply. Like this is the woman who insists on being called "Daenerys of the House Targaryen, the First of Her Name, The Unburnt, Queen of the Andals, the Rhoynar and the First Men, Queen of Meereen, Khaleesi of the Great Grass Sea, Protector of the Realm, Lady Regent of the Seven Kingdoms, Breaker of Chains and Mother of Dragons." She is an egomaniac and when she doesn't get her way, she needs people to talk her down. When she was sitting listening to the bells chime for death, there was no one talking sense to her.
Think back to Tyrion's repeated order during the lead-in to the battle. Stop fighting when the bells chime. Daenerys hearing the bells reminded her of all Tyrion's advice. The advice that was the cause of so much pain. This is why the bells set her off. In short, King's Landing burned because Tyrion wasn't as smart as they say he is.