Almost 200 years before this novel was written, a guy named John Bunyan wrote the megahit allegory Pilgrim's Progress. It's not a very subtle allegory – the main character is named Christian (get it?) who goes on a long voyage to find the Celestial City (a.k.a. Heaven). To get there, he and his friend Faithful have to go through all sorts of temptations and ten-commandment-breaking horrors. One of these is the fair held in the city of Vanity. This is an eternal fair where all kinds of worldly and selfish things are for sale. Christian and Faithful are having none of it, and Faithful ends up martyred because of his...um...faithfulness. See? We told you it wasn't a very complex allegory.
In any case, for his own novel Thackeray jacks this idea of a world in which all different kinds of vanity are on display, and no one looks too deeply beneath the surface. Anyone who picked his novel in the 1800s would have immediately gotten the title reference. Now, of course, all we can think of is the magazine. But since it too was named after the place in Pilgrim's Progress, it's all good.