Easy if you have an engine hoist and experience doing it. The most annoying/difficult and time consuming part is just unplugging everything. Oxygen sensor, throttle position sensor, coolant temperature sensor, etc... all need to be unplugged, then plugged back into the correct place on the new engine. Every time I've done an engine swap, there will be one plug that didn't get plugged in, or plugged into the wrong place, and then you have a really fun time finding what you did wrong. I recommend you buy a service manual, and make friends with someone who's done engine swaps before.
The 2008 Subaru Legacy has a flat 4 engine.
The 2006 Subaru Legacy has a flat 4 engine.
The 2002 Subaru Legacy has a flat 4 engine.
The 2001 Subaru Legacy has a flat 4 engine.
The 2004 Subaru Legacy has a flat 4 engine.
The 2013 Subaru Legacy has a flat 4 engine.
The 2014 Subaru Legacy has a flat 4 engine.
The 2009 Subaru Legacy has a flat 4 engine.
The 2010 Subaru Legacy has a flat 4 engine.
The 2005 Subaru Legacy has a flat 4 engine.
The 2011 Subaru Legacy has a flat 4 engine.
The 2007 Subaru Legacy has a flat 4 engine.