This is a complicated question ... I'll try a simple answer and hope it's adequate. Candide is a response to Gottfried Leibniz's assertion that we live in "the best of all possible worlds." Simply put, his reason was that an all powerful and all good God could not create a less than perfect world because this would make God less that perfect."
Candide is presented as a sheltered young man who, accompanied by his tutor Pangloss, whose mantra is "all is for the best in the best of all possible worlds," comes to experience a world that is quite different from this mantra. There are historical events mentioned in the book that would make one wonder how this could possibly be the best of any world, never mind the best of all possible worlds --- the brutal Seven Years War and the Lisbon earthquake are often cited as examples.
All this is motivated by Voltaire's endless attacks on organized religion and repressive governments. To believe that this was the best of all possible worlds would have meant two things, the first being that you weren't observing what was really going on, and the second that if you thought this was the best, you might not be willing to put forward the effort to change it.