Using QGIS 3.28, this can be achieved with the Geometry by expression tool.
with_variable(
'current_rotation',
main_angle($geometry),
rotate(
$geometry,
main_angle(
overlay_intersects(
'target poly',
$geometry
)[0]
) - @current_rotation
)
)
The rotation angle for each feature is found by using the main_angle function on the 'target polygon' that intersects with that feature. The main_angle of the original feature is subtracted from the rotation angle to deal with varying orientations.
From the help panel of the expression editor:
function main_angle
Returns the angle of the long axis (clockwise, in degrees from North) of the oriented minimal bounding rectangle, which completely covers the geometry.
I applied this expression on the red polygon layer. The black outlines are the 'target polygon' layer.
Result:

Red polygons are the original geometry, blue polygons are rotated to the main axis of the polygon in 'target_poly' layer (black outline).