The shepherd David agreed to fight him, but the sword and armor was too bulky, so he took his clothes off and fought with just a slingshot. He immobilized the giant, then rushed up with a sword and decapitated him.
Don't read too far, though, since in 2 Samuel we discover that David didn't do the job at all; it was Elhanan the Bethlehemite.
The story of David and Goliath in 1 Samuel was a mainstay of Sunday school classes, probably because it showed a little guy triumphing over a big guy. And because it's rather fun to imagine a nude, muscular shepherd boy striding across the battlefield, his penis swinging, the warriors all gazing in awe at his beauty.
This Italian engraving by Marcantoni Raimondi (1480-1534) gives David a massive body and a penis, with a cloak flapping behind him.
Daniele de Volterra (1509-1566) emphasizes Goliath's buffed body.
Alessandro Turchi (1578-1649) shows us a beautiful angelic David holding the gross bloody head. Quite a contrast.
Antonio Zanchi (1631-1722) clothes both David and Goliath.
Most of the artistic depictions of David and Goliath come from the late Renaissance and Baroque eras. Going by the hair and face, you would expect this nude David in Zurich to be Baroque, too, but it's actually by Ivar Johnsson, erected in 1921.
Michelangelo's David (1501-1504) is the most famous statue in the world. No Goliath around, just the nude, amazingly beautiful David, his cloak in his hand, his bag of stones at his feet, frozen at a pivotal moment of his life.
There are replicas in many cities, including Antwerp, Buffalo, Mexico City, Philadelphia, and Montevideo.
And in the living rooms of about a million gay men of a certain age, who used it to communicate gay identity in the years before Stonewall.