There are a few underlying assumptions with the question that I think should be addressed.
The Japanese Self Defense Force (JSDF) is by most accounts a proper military. It has a similar budget to Germany and actually has a larger number of active military personnel. Its navy is one of the most blue water capable and its air force is advanced, if also small. Both nations spend a relatively low % of their GDP on the military.
While article 9 of the Japanese constitution renounces war and belligerence Japan has a de facto military for decades with the justification of it being for defense. The important thing to note here is that it is Japanese interpretation of the constitution that applies even if originally the constitution was imposed by the occupying U.S. No one is actually enforcing article 9 and "not allowing them" to have a military. Japan could amend/scrap/reinterpret article 9 if they wanted to but choose not to do so. If anything the U.S. often finds the continuation a minor point of irritance.
The historical question of why this was imposed on Japan but not as strictly on Germany is not one I'm fully qualified to answer. I have read Embracing Defeat by John Dower, and it seems to be the gold standard on the topic of occupied Japan but does not address Germany is a thorough enough way for me to compare the two. I do strongly recommend the book for insight on post war Japan and know historians often recommend it and use it as a source on here. To that extent I can say the Cold War and Fall of China had a massive effect on American policy in Japan, including not just the toleration but encouragement of Japanese rearmament.
edit: This answer by u/kieslowskifan I think addresses the historical context of the prohibition. Its a shame the two part answer only has 3! upvotes, its the type of high quality answer you love to see here. Here is a relevant part but definitely read the rest. Embracing Defeat is a source.
Article 9 in Japan was far more stringent in its antimilitarism than Article 26, but it too had ambiguities that pro-rearmament politicians could exploit. Much like the Allied Control Council's declaration abolishing Prussia, Article 9 was born out of an idea that certain national characteristics were innate, in this case militarism, and the occupation had to radically restructure society to break these entrenched attitudes. As head of SCAP, MacArthur alternated between a condescending, somewhat racist view of the Japanese, and a real zeal to radically reform Japan along American lines. MacArthur's quasi-imperial governance of SCAP/GHQ meant that major initiatives could emanate from below and receive the blessing of SCAP's powerful head. Given SCAP's somewhat eclectic staff, which ranged from fervent anticommunist right-wingers to New Dealers, this imparted a somewhat incoherent occupation policy. The renunciation of war was likely the brainchild of Colonel Charles Kades, a New Dealer and chief aide of General Courtney Whitney, who was greatly influenced by the symbolic power of the Kellogg-Briand pact.