I answered a similar question on movie.SE, so I just copy the answer here
She has become mad pragmatic
While some will argue she has become as mad as her father, I will argue she has all her mind.
One important element to understand this is the dialogue she had with Jon Snow before the attack
Far more people in Westeros love you than love me. I don't have love here. I only have fear [...] Alright then," she says. "Let it be fear.
She knows she won't earn love from his people. And as Machiavelli says:
From this arises the question whether it is better to be loved rather than feared, or feared rather than loved. It might perhaps be answered that we should wish to be both: but since love and fear can hardly exist together, if we must choose between them, it is far safer to be feared than loved
the prince (1513)
As Benioff in the "inside the episode":
I think that when she says "let it
be fear" she's resigning herself to the
fact that she may have to get things
done in a way that isn't pleasant and
she may have to get things done in a way
that is horrible to lots of people.
Why did she react like this to the bells?
However, she is not totally emotionless, and it's true that there is rage inside her when the bells tolls. Because at this moment, she realised that she could have easily take Kings Landing, two seasons ago.
She realized she could have dealt with the Night King threat after becoming Queen.
She lost two dragons, Jorah, Missandei, and a big part of her army, while a simple attack with only one dragon was enough.
She realized all those previous sacrifices were useless.
How can she be such a good ruler in Essos, but so cruel in Westeros?
While it seems odd that the same character rule in a quite different way between two realms, this is not unrealistic. Bruce Bueno de Mesquita, political scientist and game theorist, studied the reign of Leopold II, King of Belgium and Congo. The exact same person rules these two kingdoms in very different ways, but there is a reason for this: the power was not held by the same people/structure. Two different kingdoms, two different ways to conquer/keep the power.
Abstract
From 1885 until 1908 Leopold II was not only the King of Belgium but also the personal owner of the Congo Free State. The policy outcomes during his reign turned out to be fundamentally different in the two countries: Whereas in Belgium he improved living conditions, in the Congo he established a brutal tyranny. This paper analyses the reasons for these different leadership styles of Leopold II by means of the 'selectorate theory'. The selectorate theory explains policy outcomes as a function of governance institutions. It assumes that the ruler maximizes his own utility which means first of all to sustain himself in power. Under Belgium's governmental institutions Leopold II required broad support from the general public but in the Congo he only needed a very small group of supporters. To reduce the possibility that Leopold's different leadership styles were caused mainly by racism his period is compared to the reign of the Congolese leader Mobutu Sese Seko.
Leopold II and the Selectorate: An Account in Contrast to a Racial Explanation, Bruce Bueno de Mesquita
The same thing can be said for Essos and Westeros. In Essos, she is seen as a liberator and can earn the love of her people, whereas she is seen as a conqueror in Westeros, and must rule with fear