I have tried the solution found in Dynamic breaks of legend text in QGIS Atlas
I am using QGIS 3.10.6-A Coruña.
I have attached a screengrab below. I use the "wordwrap" expression and it seems to work well - see "1" in red text (in the legend item properties). However, the actual legend for the layout does not wrap - see "2" in red text. Spaces in the legend text are removed - indicated by the red arrows. The red text "3" shows the wordwrap expression.
How do I fix the legend in the layout, not just in the legend item properties?

But that aside, I strongly recommend updating to a newer version of QGIS - at least QGIS 3.14 - the legend functionality has vastly improved and ironed out a lot of bugs, which your issue looks like it might be.
The most powerful improvements include being able to manually edit legend item symbols (custom shapes or symbols), and create manual column breaks.
– she_weeds Oct 04 '21 at 08:04