For citizens of 61 countries and territories it's easy to obtain landing permission on arrival without a visa. Most Western countries are included in this and it's valid for a stay of up to 90 days. Certain European nationalities and Mexicans are permitted to stay for 180 days if they note a longer stay upon entry.
All other nationalities must obtain a "temporary visitor" visa prior to arrival, which is generally valid for a stay of 90 days. There's no need to get a visa for a same-day transit between international flights at the same airport, so long as you don't leave the secured area.
If you're planning on spending your whole gap year in Japan you'll need to obtain a Certificate of Alien Registration (colloquially known as a gaijin card) within 90 days of arrival and carry it at all times. Then you just give it in when you leave.
Once in Japan, you must carry your passport (or Alien Registration Card, if applicable) with you at all times. If caught in a random check without it (and nightclub raids are not uncommon), you'll be detained until somebody can fetch it for you. First offenders who apologize are usually let off with a warning, but theoretically you can be fined up to ¥200,000.