You can export OSM XYT Tiles background map as raster file: right click on the OpenStreetMap layer and select Export / Save as...
to save a copy of the background tiled map as raster file. Be sure to define the extent and resolution of the raster.
To get the extent of a layer, simply click Calculate from Layer...
in the Extent
section of the dialog window (see dialog window on the right in the screenshot, in dem middle). If you only want to keep those pixels that intersect the polygons, use Menu Processing / Toolbox / Clip raster by mask layer
(see documentation).
However, you don't write why you need to do so, what you ultimately want to do with this raster. Maybe there are better ways to achieve that.
OSM XYZ Tiles map (brighter, in the background), and exported raster file (darker, in the middle):
Note Tile Usage policies, for example OSM Carto servers run by OpenStreetMap Foundation ( see https://operations.osmfoundation.org/policies/tiles/ ) heavily discourage bulk tile downloading and
In particular, downloading an area of over 250 tiles at zoom level 13 or higher for offline or later usage is forbidden.