Using foreign phones in Japan
Most modern smartphones will work in Japan, but check if yours supports 3G UMTS 2100 MHz or 3G CDMA2000 800 MHz. Most quad band 3G phones do, including popular models like the Samsung Galaxy line, Google Nexus phones and Apple iPhone 4/5. Older "dumbphones" or 2G only phones probably won't work.
You can simply use your home SIM and roam, paying your network's foreign roaming rate, or you can rent a SIM card. Renting gives you a Japanese phone number and some let you access data services as well, which can be extremely useful for maps and translation.
Renting a SIM
There are many companies offering SIM card rental in Japan. Most offer two types of SIM: voice only or data only. A voice only SIM can only make phone calls and send/receive text messages, while a data only SIM can only access internet services like the web and email, and often come with a wifi router so you can use a phone or laptop. A few providers offer a combined voice and data SIM. Most will allow you to collect the SIM at the airport, and then either return it there or via a pre-paid envelope in the post. There are post offices at airports.
For a voice only SIM SoftBank is a reasonable option. For a combined voice and data SIM try Advanced Communications. Their Android SIMs cost a little more than the iPhone ones, but the price will be reduced if you tell them that you don't need tethering. This wiki has no affiliation with either of these providers and does not endorse them, the links are only provided for convenience.
Buying a phone in Japan
It is almost impossible for foreigners to buy phones in Japan, except at a few small shops in Akihabara. Normally buying a phone requires you to have a permanent address in Japan. In any case, many phones sold here are either not compatible with foreign networks and SIM cards or only support Japanese language, or both. Japan is sometimes called "Galapagos" because phones have evolved independently of other countries. For example, flip phones are still popular and many models are never sold outside Japan.
The Japanese love buying accessories for their phones. As well as a vast selection of cases, you can buy charms to hang off your phone, cleaning equipment, external battery packs, screen protectors and more. Many of these items are unique to Japan and make good souvenirs, be they cute character charms or polarized screen covers that stop people standing next to you seeing what is on your screen. Large electronics retailers such as Yodobashi Camera, Labi, Sofmap and BIC Camera usually have an extensive selection.