Mostly it works by both simulating nicotine in your brain and at the same time blocking the nicotine receptors. This means that you will likely have a decreased desire to smoke, and when you do smoke you don't get the same nicotine rush. Because of the way that it blocks the nicotine receptors, using nicotine replacement isn't a good idea (it won't work).
Many people who use chantix report that cigarettes start to taste gross, seem nauseating, or they just stopped appealing to them altogether. It can triple the odds of successfully quitting and is currently the most effective medical therapy for helping people quit smoking.