Ms. Morochoduchi had been stopped nearly a dozen times for illegally selling her pastries in the subway station, Mr. Attia said, yet she always goes back. “What’s that show you?” he said. “It shows you how important it is to her to make that money, to go there and to sell them.”

“Vendors do this because they need a job. It gives them the economic mobility to work, to save money, to start the American dream.”

That is what chicken over rice has done for Mr. Attia. Today he reports to an office in a Lower Manhattan skyscraper, has won a prestigious fellowship for emerging regional food leaders, and is on a first-name basis with politicians like State Senator Jessica Ramos, who is working with him this year on her pilot project to allow food vendors to use the vacant storefronts of the Roosevelt Avenue-74th Street subway station in Jackson Heights, Queens.

When Mr. Attia came to New York City from Alexandria, Egypt, on a tourist visa in 2008 at the age of 20, the only job he could get was working under the table at a Harlem bodega for less than $7 an hour.

In Harlem, he noticed a halal food cart parked across the street from the mosque he attended. The man who owned it was Egyptian, and they struck up a friendship. “Hey,” Mr. Attia remembers the vendor saying to him, “would you like to work in the street?”

For more than three years Mr. Attia was a licensed employee on someone else’s cart — selling eggs-on-a-roll at 110th Street and Broadway, hawking hot dogs in Times Square. He and his best friend, Ahmed Mohsen, also from Egypt, managed to save up the $20,000 they needed to buy a smoothie cart and a seasonal permit on the underground market.

By 2016, they owned a second smoothie cart and a year-round halal cart on Second Avenue near 86th Street called the East Side Grill. Along the way, Mr. Attia married a New Yorker and obtained a green card, then became an American citizen. He moved to the Bronx and then Queens, and learned about the Street Vendor Project, a part of the nonprofit Urban Justice Center.