There are at least two possible solutions:
1. Use Geoprocessing / Difference
A simple approach is to create a buffer around layer B - set the buffer distance high enough that all white spaces between the two layers are covered. See screenshot: Layer A: orange; Layer B: blue; buffered Layer B: red outline.

Now use Menu Vector / Geoprocessing Tools / Difference and set the buffer layer as input and Layer A as Overlay layer. You get a perfectly fitting version of layer B, with layer A unchanged:

Snap vertices of layer B to nearest vertex of layer A
For QGIS 3.16 or higher, there is another option. You can use basically the same procedure as described here:
The idea is to create two points layer, representing the vertices of the two polygon layers using Menu Vector / Geometry Tools / Extract vertices. Than "snap" the points of layer B to the closest point of layer A using the new overlay_nearest expression, see visual changelog. Create a new point layer with Menu Processing / Toolbox / Geometry by expression and this expression, based on input layer B:
array_first (
overlay_nearest(
'layer_A',
$geometry
)
)
Than connect the points using Menu Processing / Toolbox / Points to path` and from these path create a polygon with Menu Vector / Geometry Tools / Lines to polygons.