Trifle the cake so called probably because it's a light concoction. This usage dates from 1781. Interestingly (ahem) the term sponge-cake is later, 1808.

The original sense of trifle is a deception, gibe, jest, or idle tale. It comes from the Old French trufle, diminutive of truffe, with this sense. The change of vowel is Middle English.

The origin of this Old French word is unknown.

But it is, in form, effectively the same word as truffle the tuber, and indeed probably came from Latin tuber. (The consonant changes are slightly dodgy there and it's not entirely convincing.)

In the extended form terrae tuber, 'earth tuber', this gives Italian tartufo, German Kartoffel 'potato' (with another dodgy consonant shift t -> k), and the character Tartuffe.