Japan is a constitutional monarchy, and one of Earth's nation-states. Despite being wealthy and heavy populous, it does not qualify as one of the planet's superpowers, in large part because its constitution has severely curtailed the scope of its military since its defeat by the USA in World War II. Its capital city is Tokyo. In some continuities it is a member state of the Earth Defense Command. This may greatly increase Japan's geopolitical clout, but it's hard to tell because the fiction is consistently very vague about how the EDC works.
American cartoon continuity
The Transformers cartoon
Later that year, Japan was menaced by Kremzeek, a Decepticon-created electrical creature who severely damaged the electronics manufacturing industry there.
Some time in 2006 (2010 in the Japanese continuity), the Decepticons mounted a series of nonsensical attacks on Japan. Predaking and Devastator attacked Broadside in the Sea of Japan, upsetting local fishermen, while Astrotrain attempted to ram a bullet train, and Bruticus fought Defensor outside a dojo. Despite the able Autobot defense, the extensive damaged caused the furious Japanese Prime Minister to turn into a racial stereotype.
After questioning his fitness for leadership (and managing to lose the Autobot Matrix of Leadership in a surprise attack), Rodimus Prime learns from the dojo sensei the lesson that he who deserts his obligations is already defeated. Later, a Matrix-mutated Scourge attacked a major Japanese city. Giant robots just can't stay away from the place.
Universe: The Wreckers
Some time around 2020 (Daniel Witwicky seems to be a graduate student on break from University), Japan is menaced by an entire battalion of female ninja robots approximately the size of Optimus Prime. This time Dr. Fujiyama doesn't even bother trying to explain why he had them built. Japan is saved when Daniel heroically detonates a high-powered suicide bomb, obliterating the entire group of robots.
Fun fact: this story was published in 2001.
Japanese cartoon continuity
Fight! Super Robot Lifeform Transformer manga
Some time between 1986 and 2002, the Autobots came from America to Japan on a longer-term basis, where they befriended an Elementary School boy named Kenji. Kenji was helpful enough to alert the Autobots about several of the numerous Decepticon attacks on Tokyo around this time, as Japan apparently became the focus of Megatron's raids.
When Swindle released the Cosmic Rust against the Autobots in 2003, Japanese automobile companies enthusiastically participated in the EDC's plan to produce human-manufactured bodies to replace the deteriorating ones of the Autobots who were infected.
When Galvatron was ejected from Unicron in 2005, he impacted Earth, specifically Tokyo. The EDC's mission became ejecting all Transformers from Earth. Tokyo was quickly rebuilt, and in 2006 had a force of 48 Autroopers to defend it. Unbeknownst to the population at large, the EDC is feeding children to Galvatron's spawn.
In 2011, the Trainbots were created and lived in Japan, disguised as different models of locomotive indigenous to the country.
Super God Masterforce
Japanese citizen Ginrai left his home in Nagano in his densely-populated homeland to become a trucker on the open highways of America. Meanwhile, the Pretender Hawk lived in Japan, where he was friends with Dr. Gō and his young son Shūta Gō. With the rise of a Decepticon cult made up mostly of Pretenders and humans, Ginrai found himself caught up with the Autobots and returned to Japan to stop the cult's attacks. The three children who work for the Autobots also attended a school there.
Marvel Comics continuity
Dreamwave Generation One comics continuity
Robots in Disguise
The Autobots infiltrated Japanese society in preparation of Predacon invasion, disguising themselves and working as bullet trains, police cars, fire engines and tow trucks. (In some instances, they appear to have official standing in these roles.) Their base was placed in Japan's Metro City, which conveniently was also the location of the buried Fortress Maximus. The Transformers battle often in Japan, which must piss off the locals something fierce; poor guys can't even look at steam trains in peace.
Japan's famous haiku poetry left a deep mark on Sky-Byte.
Japan also has the tallest tower in the world. Until it fell over.
Dreamwave Energon Comics
See sunny Tokyo one more time.