As tobalt wrote, it's all about surface brightness. But the crucial bit, which is not apparent enough, is _just how much brighter_ these stars are than the further away galaxies. If JWST had taken the picture with lower exposure it could have captured this more faithfully, perhaps like this:

[![Edited version of the JWST image to hint the real brightness situation][1]][1]

...but that wouldn't be very useful for scientific purposes and certainly not _look as inspiring_.

Due to a combination of overexposure of the sensor itself, and post-processing, we see much more information in the actual published image, but at the price of discarding the direct information about the foreground stars' brightness, and also of blowing the intensity of their diffraction spikes completely out of proportion. (Which does of course provide a way of estimating the true brightness again, as well as a visual impression of their "brilliance".)

  [1]: https://i.sstatic.net/MDa1E.jpg