Harrison wrote the song as a tribute to his friend Eric Clapton's chocolate addiction, and indeed he derived the title and many of the lyrics from a box of Mackintosh's Good News chocolates. Supposedly all of the confectionery names used in the song are authentic, except cherry cream and coconut fudge. The chorus ("But you'll have to have them all pulled out after the savoy truffle") is a reference to the deterioration of one's teeth after eating too many sweets. The line "We all know Ob-la-di-bla-da" refers to the song "Ob-La-Di, Ob-La-Da", which appears earlier on the album, but with the "sinister" overtone (as Walter Everett put it) that "life may not go on" as the latter song insists. "Savoy Truffle" is one of several Beatles songs that make specific reference to other songs recorded by the group (others include "All You Need Is Love", which refers to "She Loves You"; "I Am the Walrus", which refers to "Lucy in the Sky with Diamonds"; and "Glass Onion", which refers to several other songs).
Everett notes that the harmonies of the bridge (E-A-G-B) (as was the case in McCartney's "Yesterday") recast those of the verse with some condensation. Early versions of the song notably utilised Harrison's pentatonic electric piano and Telecaster, as well as the boogying saxophones.
The Beatles recorded the first take on 3 October 1968 and the final mixes were finished by 14 October. Six saxophonists (three baritone, three tenor) were brought in and were reportedly displeased when Harrison decided to distort their appearance on the recording.