Glamorization of a criminal is no different than glamorization of a non-criminal, except for the added excitement of doing something wrong. Not that glamorizing something wrong is the impetus for the glamorization itself, but it does add to its excitement. The more the excitement, the more the interest, and hence, what the media covers. In some cases, the individual may not be "interesting enough" without the added excitement.
A second factor is appreciation. Appreciating expertise in a specific field is closely related to our own involvement in that field. For example, while a person may watch the World Cup with interest, he might not fully appreciate the expert performance unless he has played the sport himself. The more he tries to become an expert himself, the more he would appreciate the actual experts. Similarly, the more he reads about a subject, the more he appreciates the experts in the field. (Pun intended.)
When a criminal takes an action, it is generally not random. Usually, there is a goal that most people can understand or there is a consistent set of actions along some line. People who have an appreciation of the goal or the subject, even if they "would never do it themselves", are led to an appreciation of the perpetrator as an expert in the field. If they have a latent desire to perpetrate the same action, but suppress the desire rather than sublimate it, they will identify with the perpetrator as well, or in extreme cases, see them as a form of secret hero, whether they realize it or not.