Japan is an endlessly fascinating place to visit, with many, many options based on whatever most interests you. I'll share my personal opinions, knowing that no two of us on this forum are likely to be in complete agreement. To me, your timing for the cities of Tokyo and Kyoto sounds great for a first visit. I also second the addition of Hiroshima, possibly Miyajima, and definitely Himeji. Keep in mind that Himeji castle was a defensive fortification and to get to the top you'll be climbing steep stairs in your socks. Nara is an easy day trip by train from Kyoto, so it isn't necessary to stay overnight (although pleasant). The main temple there, Todaiji, is amazing. The deer, in my opinion, are worth avoiding.
Ask yourself why you want to go to Osaka. Is there something there that you want to see? The castle is a concrete reconstruction. The main attraction for travelers seems to be night life and food, but all of Japan's cities have great food options.
Travel time in Japan is really dependent on train routes and fares, almost more than distances. Some place far away could be two hours on the fastest and most expensive of the bullet trains, ones that leave many times per hour, or a whole day on local train lines. Studying trains can be a good way to start planning, and then move to study public transportation in the cities you want to visit.
For areas to stay in, the subway lines in Kyoto are one place to start. There are only two lines, perpendicular to each other. Subways or fairly reasonably priced taxis are better options than the crowded and very slow buses. The main attractions are all quite accessible. Absolutely study the predicted dates for cherry blossoms - prices and crowds increase dramatically, and the blossoms may or may not be worth it to you.
For Tokyo, it's hard to choose an area to stay in because there are so many good options. You can get pretty much anywhere on the many, many subway lines. If you have a specific interest, such as the National Museums, look at any area with fairly direct access. If you want ease of access to whichever airport you use, look at the many ways to get there by train, bus, subway (that becomes a train), or monorail. There is so much good food available almost everywhere that there's no need to go to popular destination restaurants or famous neighborhoods. And then when you're tired or overwhelmed, head to the nearest conbini, the convenience stores that are everywhere, and pick up a great meal to eat in your hotel room. Conbini are a cultural experience. Enjoy!