Most of the food we consume is made out of organic materials, so it will disintegrate by time. However, similar to any other rubbish, leftovers or food scraps should not be disposed of in the sea. This habit might stick, and whilst food materials are not harmful, any other matter such as tin cans, foil and plastic cutlery can do serious damage. All the effort would be lost.
No one likes to swim in foul waters, so if you’re anchored in an area prominent with other boaters, keep the food scraps in the organic garbage bag.