At TPE, stay airside—excellent food courts and lounges make staying inside worthwhile.
Take the MRT Airport Line from Terminal 1 or 2 to Ximen Station (48 min, TWD 150). Ximending is a compact pedestrian shopping and food area directly off the station exit. Good for street food, tea, and browsing. Allow 80 to 90 minutes total for the round trip and plan to spend 60 to 90 minutes in Ximending. Re-enter the airport at least 2 hours before your flight for international security processing.
Elephant Mountain (Xiangshan) gives Taipei 101 skyline views in under 30 minutes hiking. Take the MRT Airport Line to Taipei Main, then Blue Line to Xiangshan Station (5 min walk to trailhead). Total from airport: 55 minutes. The hike to the main viewing point is 20 minutes of stone steps. For Taipei 101, take the Blue Line to Taipei 101/World Trade Center Station, 5 minutes walk to the tower. Buy observation deck tickets online (TWD 600, around $18.60) to skip the desk queue.
Jiufen old mountain town is a 90-minute bus ride from Taipei City (Zhongxiao Fuxing Station, Bus 1062, TWD 96 / $3). The town is built into a hillside with teahouses, narrow alleys, and ocean views. Allow 2 hours in Jiufen and 3 hours total travel time. Combine with an afternoon in Taipei's Da'an District for food and coffee before returning to the airport.