My grandson had to sleep in the torpedo room for his whole first year under the water.
He served on the nuclear sub Jimmy Carter, for four years.
Thyey broke the days underwater record at that time.
IIRC, it was 169 days.
That is, continuous days submerged.
I was curious about how oxygen was produced in a submarine. This article says it’s by electrolysis (using electricity to split H2O into hydrogen and oxygen, and then venting the hydrogen outside the sub):
https://www.ussjpkennedyjr.org/how-nuclear-submarines-generate-their-own-oxygen/
The article points out that you need to do something in addition to creating new oxygen. You also need to remove CO2 from the air, which is done by passing the air through calcium hydroxide or sodium hydroxide.