Found some interesting info on how the night fighter version of the J1N1 first came to be:
"By 1943, Japanese forces in the Pacific War were on the defensive. The major south Pacific bastion of Rabaul was under attack night and day by allied bombers. At that time, the Japanese had no regularly-constituted night fighter force. CDR Yasua Kozono of the 251st Naval Air Group developed a cannon-armed night fighter from two derelict J1N1s and brought them to Rabaul. Significantly, and without any consultation with the Luftwaffe, Kozono had the aircraft fitted with weapons that fired at an oblique angle.
The first success against a nocturnal B-17 over Rabaul came on May 21, 1943, proving Kozono's concept. During the remainder of the year, the two aircraft managed to knock down approximately 30 B-17 or B-24 night raiders over Rabaul, and the J1N1 became known to the Japanese as the "Gekko" or "Moonlight." The Allied code name was "Irving".
By September 1944, 486 Gekkos had been produced, as both the Type 11 early version and the Type 11 late version; these were visually distinguishable by the stepped rear upper fuselage of the earlier aircraft. In the Home Islands, the 302nd Naval Air Group, based at Atsugi, became the leading B-29 killers with the "Gekko" as the raids increased after November 1944."
J1N1-S Type 11 early version:
J1N1-Sa Type 11 late version: