The reputation of being poorly optimized only applies to version 5, UE was rather respected before the wave of terribly performing UE 5 AAA games came out and tanked UE's reputation.
It also has a terrible reputation because a bunch of the visual effects have a hard dependency on temporal anti-aliasing, which is a form of AA which typically results in a blurry-looking picture with ghosting as soon as anything is moving.
Let's be real. UE5 is a marketing term for a .x version of UE4 that broke a bunch of the rendering pipeline such that they needed am excuse to force devs to deal with the changes.