My quick answer would be AZ State Route 87
from Phoenix through Payson to Lake Mary Road and following that to Flagstaff. (Roughly 165-170 miles & 16,000' accumulated elevation gain.)
To provide the most usable information it would be helpful to know a few things:
1. Do I understand correctly by 'scenic way to ride' you mean bikepack your way to Flagstaff in 5 days?
2. If so, what kind of daily mileage are you used to riding?
3. What kind of terrain can you handle?
4. How many day's worth of food/water would you have? (I'd guess at least for water you'd want to resupply daily)
As far as riding on the AZT from Phoenix to Flagstaff, in my opinion the easy answer is NO.
1. The AZT does not come within 40-50 miles of Phoenix proper (no matter where you joined it, you'd need a ride to reach it)
2. As far as I am aware, there are at least a few sections not conducive to biking... and certainly not within a 5 day time frame. (You'd probably be walking next to the bike more than you'd like.)
3. The closest easy (car) access from Phoenix to the AZT would be taking Highway 87 the 50+ miles to Sunflower, where Sycamore Creek crosses Highway 87.
Even from that point you are talking 185-190 miles
on the AZT, including almost 20,000 feet
of accumulated elevation gain.