What is going through their heads? Nothing. Literally.
People who commit these crimes react entirely in the moment, they do not indulge in forethought, or put any mental effort into pondering the consequences of what they do. That requires a level of intelligence which these people simply do not posses.
If something frustrates or angers them, their response is to lash out. That is the normal reaction of us all - it's instinctive, but as babies and toddlers, we are taught that this is not appropriate behaviour, and we grow and understand society around us, we learn to respect other people, and their possessions.
For ferral individuals like this, such filters have never been put in place, because thewir parents never understood enough to put them there, so the circle goes on and on and on.
If and hopefully when they are caught and someone asks them why they did this, they will look blank and answer that they do not know. Tragically, this is the correct answer.