I only buy data-only SIM card because I do not like to carry things, so won't talk about renting a mobile hotspot here. So you need a unlock phone.
You buy data-only SIM at the airport / BIC Camera / Yodabashi Camera. They’re everywhere. The SIM card you can buy are 2nd class citizen (MVNO) of the premium networks (Docomo, Softbank, au).
It’s usually like 2GB valid for 7/14/21/30/90 days for $30-50 bucks. You can also later buy cards with access code to recharge your data.
Depending on the length of trip, you pick the most data + use of days at the shop you're.
The staff at shop will help you set up the phone. Sometimes you need to install a APN profile on your phone. You need to remember to remove the profile when you returned home, otherwise your mobile at home will not work.