There were no sirloin tips or rack of lamb for peasants in the Middle Ages. Those in the lower economic classes might not have even known what they were having for dinner - hence the "luck" in "potluck."
To stretch the family food supply, peasant wives (and one can safely assume it was always the wives) would drop leftovers into an iron pot and reheat them over the fire day after day. She and her family would eat "potluck," or whatever happened to be in the pot. (The "Pease porridge hot/ Pease porridge cold" nursery rhyme suggests that leftovers might be reheated for a long time - nine days, perhaps?)
"Potluck" was first recorded in 1592 as a counterpart to the French pot-au-feu ("fire pot"), or what we know today as a buffet of whatever happens to be handy.
SOURCES: 'Why You Say It' by Webb Garrison; 'Loose Cannons and Red Herrings' by Robert Claiborne, 'Dictionary of Word Origins' by Jordan Almond; 'The Encyclopedia of Word and Phrase Origins' by Robert Hendrickson.