I would say that there were two reasons why the United States wanted to occupy Japan for a period of time after World War II.
First, the US did not want Japan to be able to threaten American interests ever again. After Japan had brought about the war in the Pacific, the US did not want to have to worry about a repetition. The US felt that it could occupy Japan and destroy that country’s ability to wage war in the future. This would secure American interests in the Pacific.
Second, the US was clearly looking ahead to the Cold War. This is why the US “wanted Japan to become a capitalist nation.” (We should note, however, that it is not really accurate to say the US wanted Japan “to become” capitalist. Japan had already been capitalist before the war. So it is more accurate to say that the US wanted Japan to remain capitalist.) The US wanted Japan to be capitalist so that Japan would be on the side of the West in the Cold War. With Japan on the West’s side, the Soviet Union could not use the islands as an outpost for its military. Instead, the US could have military bases in Japan that would help to contain communism.
The US wanted to occupy Japan, then, in order to keep the peace in the short term and to help ensure that communism would not spread in the long term.