I am hearing 3rd hand that someone (not sure which cruise line) was able to get box lunches from the cruise ship even when they did not do an excursion.
Doing a search here I found references to box lunches but it sounds like you get it for an excursion, can you get these if you are just planning on walking around? And where do you get them?

I also saw people suggest taking stuff from the buffet in a baggie but if they have it ready made then that would be better.

Do the proposely create a bunch of box lunches for people to take with them off the ship? No, I have never seen that.

Some people have taken buffet food and some people have suggested ordering room service sandwiches for this purpose, but I'm not sure its worth the effort. And some ports prohibit food from being taken off the ships (local laws to protect the local food/crop industries I'm sure.)

The only box lunches we've had were included in excursions. Normally, you have plenty of time to come back to the ship for meals. We'll normally have breakfast, do either a snorkel excursion, walk around the port, or tour the island; come back to the ship for lunch then do a snorkel excursion, walk around the port, or tour the island. I have heard of people taking things from the buffet or using room service as well. I don't want to chance doing something wrong. Plus, I can drop stuff off in the cabin. Sometimes when the port visit is short, we'll grab a snack locally.

For goodness sake, let's not have a repeat of the "taking food off the ship" fiasco. Some excursions provide food. There are plenty of restaurants or other food available at 99% of cruise ports and no, local customs and laws do not favor gringos bringing food off (or on) the ship.

While you're off the ship, if you get hungry, simply stop in at Margaritaville, Carlos & Charlies, Senor Frogs or any of a number of other great places to visit for lunch. They have great atmosphere and always great food. Gives you a chance to relax in the AC, get a good meal and not have to walk all the way back to the ship, wait for the check-in line and elevator and waste half your day at port. Well worth the cost of a meal and a cold brew or drink of your choice!