Provisioning the boat was the boat navigator's job. He doubled as the ship's quartermaster. I don't know if there was ever a case of a U-Boat running out of food before running out of fuel. Maybe.

The Milchkuhs and supply ships and subs always sent fresh provisions over in addition to fuel and torpedoes. I've also seen photos of crew members sharpshooting at sharks and other marine animals and hauling them aboard to augment their diet. Spoilage certainly was a problem, especially on tropical patrols.