Here is approximately how it happened: Japan exported heavily, piling up trade surpluses. Eventually the currency appreciated sharply (250 yen to dollar in 1980 to 100 yen to dollar by 1990), making Japan a first-world nation in terms of per-capita GDP. Yet, Japan's overall economic structure wasn't and still isn't as balanced as more mature industrial economies like Germany.
Imagine a kid who has been trained and trained from age 4 to be a world-class chess player (with no exposure to anything else). He/she could achieve world-champion chess player at 25, but would be a highly imbalanced individual. Japan's economic story in a nutshell.
You can see this when you travel to Japan: their service sector productivity sucks. Over-staffing is rampant. As a society they have chosen to redistribute the enormous surplus from exports to sustain inefficient employment in a lot of far-less-than-world-class businesses. Their totally undeveloped software sector shows the real cost of their mercantalism. Their woefully tiny housing (NOT to be attributed to population - Singapore has higher population density, has lower per-capita GDP than Japan, yet Singaporeans enjoy larger apartments and overall live better than the Japanese) is an everyday reminder of the cost.
On balance Japan has done fine, but considering that they are the hardest working people on the planet, they could have lived better, and could live better today, if they hadn't developed that export obsession. They gifted the rest of the world a lot of their hard work, while denying themselves those fruits.
As an outsider, I can't complain, I love my Japanese luxury car ;)