A “vanity” is some physical object that’s considered sinful or promoting of sinfulness (e.g. alcohol, pornography). So a “bonfire of the vanities” is a burning of these objects as a symbolic act to promote holiness and rid the world of temptation.
The original “bonfire of the vanities” was an actual event in 1497 where supporters of a Dominican preacher burned things considered immoral. From Wikipedia:
The focus of this destruction was on objects that might tempt one to sin, including vanity items such as mirrors, cosmetics, fine dresses, playing cards, and musical instruments. Other targets included books which Savonarola deemed to be immoral (such as works by Boccaccio), manuscripts of secular songs, and artworks, including paintings and sculpture.
The phrase is more commonly known as the title of the 1987 novel by Tom Wolfe, and a 1990 movie starring Tom Hanks.