There is no one way to answer this question. Some criminals are rational. Some are driven by psychological and emotional factors. Some are a combination. There is no single source of motivation that drives all criminals.
Let us look, for example, at a young man from a very poor neighborhood who becomes a drug dealer and perhaps an occasional thief or mugger. He may be acting in part rationally. He may believe that he has no real chance of becoming well-off and respected in a legal way. Therefore, he turns to crime as a rational alternative. Of course, he may also mug people partly out of anger about his position in society.
Now let us look on the other hand at some like Ted Bundy or like the “Son of Sam.” These people are clearly driven much more by psychological or emotional urges that they cannot control.
As these examples show, we cannot identify a single mindset that is common to all criminals and which causes them to commit their crimes.