Because solar panel math doesn't work.
It's the same reason it makes no sense to put solar panels on a car: the solar panels would add minutes of driving daily.
You would need massive area of solar panels to power a sub which is obviously not workable if you want to be stealthy.