It’s more disturbing to look at a painting of a beheading when you know that the artist had recently murdered a man.
In 1606, Caravaggio killed Ranuccio Tomassoni in Naples, possibly over a gambling debt. Caravaggio fled to Malta, where he was welcomed by the Grand Master of the Knights of Malta, Alof de Wignacourt. But being a famous painter can only get you so far, and after getting in another fight and stabbing a knight, Caravaggio was imprisoned.
When did Caravaggio paint David with the Head of Goliath? After his jailbreak of course. Caravaggio escaped from the Knights of Malta, and traveled through Sicily and Palermo. During this time, he painted two paintings of David and Goliath, one currently on display in the Kunsthistorisches Museum in Vienna, and this one—maybe the most controversial painting of his career. This painting is darker and more contemplative than its twin, and is the subject of pretty wild speculation. Goliath’s head may be Caravaggio’s self-portrait. David may depict Caravaggio as a young man, or may be a portrait of Cecco, Caravaggio’s studio assistant and lover. Considering the angle of the sword, I'm guessing it’s Cecco.
Self-portrait or not, Caravaggio sent David with the Head of Goliath to the Roman Cardinal Scipione Borghese as a request for a pardon. If you look closely, you can see the letters H-AS OS on the sword, though to be an abbreviation of the latin phrase humilitas occidit superbiam—"Humility kills pride”
Reed Enger, "David with the Head of Goliath (1610)," in Obelisk Art History, Published January 30, 2015; last modified November 07, 2022, http://arthistoryproject.com/artists/caravaggio/david-with-the-head-of-goliath-1610/.