Three weeks is the sweet spot for a first trip to Japan — long enough to slow down after Tokyo without having to choose between the classic sights and the quieter corners.
Give Tokyo four or five days before you move on — it rewards a slower pace than most first-timers allow, and the neighbourhoods matter more than the checklist sights. Buy a JR Pass before you fly if your route is heavy on trains; it pays for itself within two or three long-distance hops and turns the shinkansen network into something you use on a whim rather than ration.
From Tokyo, work west through Kanazawa for its preserved samurai district and the Kenroku-en garden, then on to Kyoto for four or five days minimum — a week if you can manage it. Kyoto is where most itineraries stall out on temples; break the pattern with a day trip to Nara for the free-roaming deer and Todai-ji's great bronze Buddha, or into the Japan Alps around Takayama for mountain air and a break from cities.
Close the loop in Hiroshima and Miyajima before a final soak at a ryokan somewhere quiet — Kinosaki Onsen or the hills above Hakone both work well as a decompression stop before flying home. Three weeks sounds generous until you're planning it; resist the temptation to add a fourth region and let the places you do visit breathe instead.