Sea water entered San Juan through its snorkel. see http://www.abc.net.au/news/2017-11-28/ara-san-juan-water-entered-missing-argentine-subs-snorkel/9199446 of 28 November 2017
Comment - It is not unusual that a small amount of sea water through its snorkel can enter a submarine. But San Juan's snorkel pumping equipment may have been too old and faulty to remove the seawater before its volume became too much to handle. This has happened before with San Juan, but on 15 November 2015 became catastrophic.
On 15 November 2017 a San Juan crewman reported: "Entry of seawater by ventilation system to battery tank No. 3 caused a short circuit and the beginning of a fire in the balcony of battery bars, bow batteries out of service, at the time of immersion, propelling with a split circuit. I will keep staff informed," https://www.upi.com/Top_News/World-News/2017/11/28/Last-message-from-missing-Argentine-submarine-warns-beginning-of-a-fire/4701511880120/ of 28 November 2017.
Comment - Seawater in the snorkel system then entered San Juan's ventilation system, then gushed down to San Juan's batteries level. This seawater-battery contact produced hydrogen gas. Hydrogen gas (once seawater caused electrical sparks ignite it) can then catch fire and explode.