The only current Subaru with
anywhere near 5k towing capacity is the Ascent SUV.
The current Legacy Outback (much larger than the Impreza) maxes out at 2700 lbs or 270 lbs "tongue-weight". Also the towing limit is
GREATLY reduced if towing a trailer without its own brakes.
Further, the reason for these capacities is
not related directly to horsepower or engine torque (although more power = more hill-climbing ability) it has to do with the carrying capacity of the rear-suspension/springs and the structure of the hitch-mount area. (also total vehicle weight)
The Impreza weighs
less than 3500 lbs soaking wet lol... towing a 5k lb trailer with approx
TWICE the "tongue-weight" of its actual capacity using a tiny, short-wheelbase 3k lb vehicle is likely to end
extremely badly even if you do manage to get it moving!
(like out of control flying backwards off a cliff badly)