Japan had a number of I-400 submarine carriers that were designed for Panama Canal raids in mind. However, it bears mentioning that the payload size of the submarine launched float planes (the Aichi M6A Seiran), was a miniscule 850 kilograms. They were basically limited to one of three loadouts: a pair of 250 kilo bombs, a single torpedo, or a single 850 kilo bomb. You're not going to even scratch the canal locks even with four or five of those Seirans.
How much damage would a ww2-era nuke do to the Panama canal?
An ATL with much faster development of atomic weapons could see most major powers getting them before a WW2 starts.
Truk Island to Panama is 14,000km. A B1 submarine had a range of 26,000km, so given a rendezvous with another vessel to refuel on the return the mission is achievable, so everyone can stop saying ‘how do they get there’ now.
If somehow you do give Japan Nukes, or really any world power them who is hostile to the US, and that is a huge leap, delivering it to the Canal is neigh-impossible unless it is a suicide mission where a ship hides it in its hold and sets it off while in the canal, and even then that seems doubtfully.