If your focus is on the Grand Canyon then I agree with Tet.
If, however, the Flagstaff or Williams question is in addition to, not instead of, staying at the canyon, then we'd need to know more about your likes and dislikes and desires on ways to spend your time while visiting to know which would be better for you.
Flagstaff does have a lot of chain hotels. They're generally reliable and you know what you're getting into. However, if that's not your thing, there are also quite a few Bed & Breakfasts and several independently-owned motels in the area, particularly along Route 66. Note the reviews, though. They're not coming up at the top for a reason.
If you decide you'll be choosing between Flagstaff and Williams, please post again with the types of things you like to do when you're not sleeping and we'll weigh in on the best option for you.