The English translation uses ‘a grin’ and ‘grinned’ to render the original Danish grin and grinede. In the original, the quoted passage reads as shown below; I have emphasised the relevant words. The greater length of the original text is due to the fact that the translation from which the quote in the question is taken is to some extent an abridged one (note, for example, that it leaves out any mention of God).
Gik der nu en god from Tanke gjennem et Menneske, da kom der et
Griin i Speilet, saa Trolddjævelen maatte lee af sin kunstige Opfindelse. […] Nu vilde de ogsaa flyve op mod Himlen selv for at
gjøre Nar af Englene og “vor Herre”. Jo høiere de fløi med Speilet,
des stærkere grinede det, de kunde neppe holde fast paa det;
høiere og høiere fløi de, nærmere Gud og Englene; da zittrede Speilet
saa frygteligt i sit Griin, at det foer dem ud af Hænderne og styrtede
ned mod Jorden, hvor det gik i hundrede Millioner, Billioner og endnu
flere Stykker,
The problem with the quoted translation is that the Danish words refer to coarse laughter, not only grinning. The intended meaning is therefore that the mirror is literally shaking with laughter.
This is also seen in the use by Andersen of the verb sitre (zittre in the original text as quoted, at the time a relatively recent loanword from the German), to describe what is happening to the mirror. Sitre means ‘to tremble’. The translation above omits that part of the sentence. The quote that follows is from another, much more faithful, translation, that of M. R. James (1862—1936) published in 1930.
If a kind pious thought passed through a man's mind, there came such a
grimace in the glass that the troll-devil couldn't but laugh at his
clever invention. […] After that they decided to fly up to heaven
itself and make fun of the angels and of God. The higher they flew
with the glass, the more it grimaced, till they could scarcely keep
hold of it. Up and up they flew, nearer to God and His angels, and
then the glass quivered so fearfully with grimacing that it fell out
of their hands and was dashed on the ground below, where it broke into
hundreds of millions, billions, and even more pieces;