But he didn’t want to touch the white linen napkin on the table. It was too clean.

“I thought I wasn’t worthy to use it,” said Johnny, 45, who said he suffers from schizophrenia and whose real name is John Carbonell. “I used the one that was in the basket where the bread was.”

For the next several months, Johnny would drift between his old life underground and his new one above it, struggling the way a man freed from prison must readjust to society. It is easy in a sense to take the city’s homeless people off the streets, but it is harder, as Johnny’s odyssey illustrates, to take homelessness out of them.

Even after Johnny moved into the apartment the first week of January, he returned to the wooded area around the cave to feed Meow Meow and the other stray cats he had named. His first several days in the apartment — a light-drenched one-bedroom unit with hardwood floors and a large kitchen in a five-story building — he did not bother locking the door. “There’s no doors in the cave,” he explained.

He had bold ambitions of starting over: He talked about getting a sewing machine, so he could design clothes, and he refused to move his belongings from the cave to the apartment because he worried about bringing in bugs. He wanted to put up “No Smoking” signs, vowing not to indulge his old addictions in his new environment. Johnny, an ex-convict who served time in the early 1990s for a drug-related offense, has been smoking cocaine since he was a teenager.

Image Johnny uses two pieces of plywood as the door to the place he has called home for 21 years. Credit... Nicole Bengiveno/The New York Times

One Sunday in January, Johnny slept on the bed, on top of the covers, wearing a leather jacket and muddy boots. He resembled not the sole occupant of Apartment 3B, but a visitor. He said he spent the night in the apartment, then went back to the cave at 6 a.m., then returned later that morning to the apartment. The flashlight he used in the cave still shone inside his jacket pocket.