Gunnery Sergeant Hartman (or Gerheim, as the book calls him) isn’t a good guy or a bad guy. He is not a guy at all; he’s a symbol. He’s not meant to be a three-dimensional character, a living and breathing human. He is the embodied manifestation of industrial-scale Western warfare.
Hartman isn’t supposed to be a person. He’s a personification of the government/military machine that is using and destroying young men for purposes both vague and distant. R. Lee Ermey does a fantastic job of making Hartman seem realistic, but he is still just a symbol.
Assigning “good” or “bad” to the character of Hartman quite misses the point; it’s the phenomenon of an industrial, Western military that is bad. It destroys Lawrence/Pyle and Hartman in boot camp, and then later destroys a number of young men in Vietnam. Kubrick’s films frequently explore the concept of dehumanization and the coldness and abstraction of violence; in Full Metal Jacket he explores how war destroys people. The purpose of the extended boot camp part of the film is to demonstrate that the evil of war is rooted not just in the mechanics of combat, but in the way that the military takes young men and turns them into killers.
Contrast “Full Metal Jacket” with another war movie very famous for its violence, “Saving Private Ryan.” In SPR, skipping by the bookends with the old guy, the movie begins on Omaha Beach and ends in a meaningless town in France. It begins and ends with combat. The characters are deliberately portrayed as being ordinary schmoes who have no choice but to engage in ferocious, often suicidal combat, and who are killed and maimed in a manner that is effectively random and defies any sort of logic or justice. Spielberg’s film concentrates purely on the horror of war itself; the viewer is subjected to over two hours of genuinely horrifying, realistic combat in which death is meted out seemingly at random. But in SPR, you get the sense that the soldiers involved are civilians who were just born at the wrong time and got rounded up and sent off to war… which is, of course, quite true.
In FMJ, Kubrick’s emphasis is not on the horrors of combat, but on the horror of the dehumanization of soldiers through their training and the military organization and culture itself. That’s why Kubrick spends so much time on Parris Island and kills off Pyle and Hartman there; his message is, in part, that the military destroys people. Unlike previous war films, which suggested that the military destroys people only because of the inconvenient fact that it has to send them into combat because of pesky foreigners, Kubrick’s military destroys people by taking away their humanity; the process of converting a civilian into a soldier is dehumanizing process in and of itself.
Spielberg starts his tale in Normandy, because spending time at basic would have been a waste of time, as his message is that combat is horrifying - specifically, that it is much more horrifying than Hollywood had been leading you to believe. (Though frequently copied since, at the time SPR’s combat scenes were of unprecedented realism.) The dehumanization of the soldiers is not nearly as prevalent in the film; in fact, we are asked to continue considering the humanity of the soldiers (note that Private Ryan cracks towards the end of the final battle, cowering and weeping, though he previously had fought very bravely; he’s snapped from shell shock) because that emphasizes the horror of what is happening to them.
Both messages are fascinating and carry a lot of truth.