If you're arriving at 5AM, plan for at least an hour to get out of the airport. The first train from T2 leaves at 6:36 AM and they run every 10 minutes. It takes 30 mins to get from there to Dongzhimen, and 45 mins to get back to T2 (on the way back it goes to T3 first). With BPs in hand, I'd suggest arriving an hour before your flight on the way back to be safe.
A taxi in the morning should be faster if you take it before 7AM.
If you want to go to the national museum, Tiananmen square or the forbidden city - you need to make reservations in advance. Tiananmen square is free, the others you need to pay. Summer palace is also an option, and usually doesn't require advance rezs.
Another suggestion is to take the airport express to Benxinqiao, walk from there along Jiaodaokou East Street, which will turn into Gulou East Street. Along Gulou East St, or in one of the hutong alleyways find something for your breakfast. From there wander through the Drum tower, and ShiChaHai. Take line 8 to ZhuShiKou and walk up Qianmen Street towards Tiananmen Sq. If you have the rez, go to the square and into the Forbidden City, have lunch north of the forbidden city and take the subway back from Benxinqiao.