Answers will be at different stages of Japan's history.
Japan was considered isolationist by Western colonists for quite some time and succeeded in delaying all forms of colonization until basically the mid-1800s approximately around the beginning of the Meiji Restoration. The same playbook was followed in Japan as towards other colonized countries: forced to abandon tariffs and sell off lands and companies to foreign powers or we will destroy you with our Navy (this time, the US Navy). The Meiji Restoration was in many ways a reaction to this and bolstered Japan's own military power to reject much of the colonial policies that had been forced upon them. There is of course more to it than this, and much about their economic base, but their military power and deciding to use it to secure their own trade positions is what guarded them against the extraction and travesties that their neighbors suffered at the hands of European powers.
Japan fully reoriented around becoming its own imperial power beyond the borders of Japan. It was carving out its own sphere of influence and this was so fully at odds with US imperialist interests that Lenin famously predicted a war between them. Japan set out and did its own version of imperialism on its neighbors, famously in Manchuria and Korea and then eventually carrying out the full-scale assault and expansion during WWII.
You might then wonder why Japan kept a high economic status after the war given that it was the US' rival and that a "strong Japan" had been directly against its interests. The answer to this question is anticommunism. The US took every foothold they could to maintain forward bases against (first) the USSR (who actually forced Japan's surrender), (second) China, and later Korea. That included maintaining sea and air power throughout the Pacific, in Japan, in Taiwan, and taking over European colonial outposts in places like Singapore and Indonesia. Japan in particular got the Marshall Plan treatment of getting built up to act as a counterbalance to the neighboring communist countries, receiving a steady stream of stimulus from the imperialists and hosting US military bases and personnel.
This is, more or less, why Japan has kept its economic status. It's no guarantee, of course. The US deliberately crashed their economy in the 90s because they were outcompeting them on key industries.