Depot Ships
Submarines were relatively small compared to most oceangoing vessels, and generally did not have the ability to carry large amounts of food, fuel, torpedoes, and other supplies, nor to carry a full array of maintenance equipment and personnel.
The tender carried all these, and periodically met up with a submarine at sea to replenish it. In some navies the tenders were equipped with workshops for maintenance and as floating dormitories with relief crews.
With the increased size and automation of modern submarines, plus their reliance on nuclear power, tenders are no longer necessary as they once were.