The James Webb Space Telescope is not a replacement for the Hubble Space Telescope. It's a successor inspired by Hubble’s previous results.
It's the next step in answering the question: “What’s up there?”
And it's not just “better” the way a 2022 digital camera is better than one from 2005.
Hubble produces images primarily by looking at light in the visible and ultraviolet spectrums of light — that is to say light that humans can see and light with shorter wavelengths. Webb creates images in the infrared and near-infrared spectrum — light with wavelengths longer than light visible to humans.

This is an important difference due to the way light changes as it travels across the universe.
Without getting too deep into the weeds of general relativity, the light is stretched as it travels. This stretching increases the wavelength of the light, moving it from the visible spectrum toward infrared. By being able to see more of the infrared spectrum, Webb can see objects that are more distant than Hubble can.

To complicate things just a bit more, when we see objects farther away, we are actually seeing older objects. This is because light takes time to travel, so by the time it reaches us here on Earth we are not seeing a distant star as it is today, but as it was thousands or millions of years ago. For example, the Cosmic Cliffs region of the Carina Nebula (top of the page) is roughly 7,600 light years away from us. So that image isn’t what the cliffs look like today, but what they looked like 7,600 years ago when that light left the nebula.
This means Webb is essentially letting us see further back in time. “Essentially, Hubble can see the equivalent of 'toddler galaxies' and Webb Telescope will be able to see 'baby galaxies.'"
