Diff'rent strokes, but I'd say trying to catch some action on the Capitol Sub is not a bad idea, but I'm biased since the Cap is my "home" line
. Depending on the time of day and where you choose to visit, you'll most often see intermodal, unit autoracks, the Tropicana juice train, unit municipal waste, mixed freight, unit coal... and there are a number of nice spots along the Cap that are safe, convenient and offer good photo opportunities.
Presuming you don't have access to a car during your layover, you're likely going to be getting around using either Metro, MARC or VRE. If you're trying to get around by Metro, the places that have already been recommended in this thread are good and worth a trip to.
In most cases you're going to want to take the Metro to a location and then walk over to a convenient vantage point. There's actually a lot of places in the Metro system where CSX and Metro run parallel, and some stations provide nice views, but railfanning from Metro platforms is always a gamble, and you can forget about using a tripod on Metro property.
From out of Union Station Metro's red line runs north along the Metropolitan Sub most of the way from shortly after the NY Ave station up to and through Silver Spring and then picks up again from Twinbrook to Shady Grove. Silver Spring once used to be great but it's hard to railfan these days for the reasons SurlyKnuckle gave, but also because construction in that area over the past years has made vantage points for railfanning less easy to find.
At both Greenbelt and College Park on Metro's green line you can get off the Metro and go over to the nearby MARC stations that are on the Capitol Sub. Both afford some decent vantage points for photography. Greenbelt has nice views with old B&O color position light signals, but the station itself is a longish walk from any amenities.
Heading south out of town by Metro you get a nice view of Long Bridge on your left as you go into Virginia. Occasionally you'll get lucky and see a train on it. The Braddock Road Metro station is at the southern end of what used to be Potomac Yards. The yards are gone now, but there's still almost always a freight sitting there waiting to get clearance when I go by on the Metro. I haven't poked around there enough to determine if there are any good spots these days near Braddock Road station to get some pictures.
For railfanning the Virginia suburbs via public transporation Alexandria is probably best if you want to stay put for any appreciable time. The Amtrak station right next to the Metro station provides nice photo viewpoints and there are plenty of amenities nearby.
If you take MARC out of Union Station, you can stop off at a number of excellent railfanning spots. Headed out the Metropolitan Sub (MARC's "Brunswick Line"), some good places you can get to by MARC are Kensington, Gaithersburg (which also has a small RR museum), and Point of Rocks (where the Metropolitan Sub meets the Old Main Line). Further on down the line you can get to Brunswick by MARC, where there's generally something going on, but that's starting to get somewhat far afield from DC.
For the Capitol Sub side of town SurlyKnuckle already mentioned Riverdale and St. Denis. Both are on MARC's "Camden Line" and are two of my favorites. Riverdale is conveniently accessible by MARC and a comfortable spot to stay put a while, with amenities nearby. Depending on the day of the week and time of day you go, you can catch a pretty decent amount of freight traffic. You're likely to run into other railfans there, especially in the late afternoon.
College Park & Greenbelt I already mentioned above; both are accessible by MARC and Metro. North of Greenbelt the best next stop on MARC is probably Laurel. Laurel has a nice historic station building. The photo angles aren't bad and there's food and such in walking distance.
St. Denis is a few stations further up the Capital Sub and is superb for railfanning as it's at the junction of the Capital Sub and the Old Main Line, but ironically despite the fact that it is at a MARC station, it's actually hard to reach St. Denis by train--the only MARC trains out of DC stop in St. Denis after 5pm and there's no return to DC until the next AM. So it's likely going to be tough to get to (and from!) unless you have a car.
Hope this helps and that you find some good stuff trackside in the area.
James