Japan was a medieval world who's leaders were unwilling to change. Some people wanted change and actively sought it. When the Americans forced change they took the opportunity and said never again will another country do this to us. So they built a big army, navy and later airforce. Some time later some other Japanese used these assets to attack the Americans. (revenge perhaps?) They lost. The Americans sailed into Tokyo bay as a hostile force for change a second time. So the Japanese said for a second time, never again.