Initially, the JWST was designed to observe the most distant galaxies possible, in order to study the first phases of the Universe. Indeed, the speed of light being finite, the farther we observe, the more we can "go back in time". This first objective of the JWST explains why it was designed to detect infrared light: because of the expansion of the Universe, the further away an object is, the more its light is red-shifted.
The telescope will also address the problem of "dark matter", the mysterious cosmic ingredient that must be added to our models to fit not only the Universe as a whole, but also the dynamics of its large structures (clusters of galaxies, galaxy, etc.).
Finally, and most importantly, it will allow us to study exoplanets in a much more advanced way than what has been done so far. The large size of its primary mirror combined with the infrared capability of its instruments will indeed allow us to study the atmospheric composition of a large number of exoplanets, including rocky and potentially habitable planets orbiting small cool stars like TRAPPIST-1. In the worst case scenario, it will tell us that these planets are generally unable to maintain a substantial atmosphere because of their proximity to their small star. In the best case, it will reveal for some of these planets atmospheric compositions that can only be explained by the presence of life on their surface.
But this list is far from being exhaustive, the JWST mission being open to the whole scientific community, it will be used for many other projects, as, for example, in the study of objects of our solar system.