There is a plugin that does what you need: Mask
Or since 3.22 (no sure the version), there is also a new type of symbology called « inverted polygon render », with which you can do a mask outside your polygon
(Get there via: right click on layer name -> Properties...
-> Symbology
-> select Inverted Polygons
from dropdown menu on top.)