The etymology of the word pie (in the edible sense) has been something of a mystery; the American Heritage Dictionary cautiously says “Middle English” and leaves it at that. Alison Richards, at NPR’s food blog, takes the occasion of the upcoming Thanksgiving holiday (in the U.S.) to cite the OED’s entry—and links to it in such a way that you can read it even if you’re not a subscriber, which is great. As she says, it “may well derive from the Latin word pica, meaning magpie”; here’s how the OED puts it (in the new third edition):
The dish, which originally consisted of any variety of ingredients, may have been named by association with the bird, either after the bird’s spotted appearance or after its tendency to collect miscellaneous articles. In this context, the similarity between the words haggis n. and haggess n., a name for the magpie, has been pointed out; compare also chewet n.1, a dish of mixed ingredients, and chewet n.2, a name for the chough.
For an alternative etymology < an unattested variant *pis of Anglo-Norman puz and Old French puis pit, well (Middle French puis, French puits; < classical Latin puteus: see pit n.1), and thus an assumption that sense 2 is in fact the original sense, see C. H. Livingston History and Etymology of English “Pie” (1959 ).
Compare post-classical Latin pia (1303, 1317 in British sources), which is perhaps < English. [...]
Compare also post-classical Latin pica pie, pastry (c1310, 1419 in British sources; perhaps identified with classical Latin pīca magpie: see pie n.1) .
Ms. Richards expands entertainingly on those suggestions (and links to some other OED entries); she ends her essay: “So as you eat this year’s slice of pumpkin or apple pie, I hope you’ll enjoy the thought that each sweet mouthful of fruit and spice carries the memory of an ancient magpie treasure trove.” I add my own hope that everyone who celebrates the holiday Thursday gets through it without either heartburn or family drama. (Pro tip: Using a butterflied, or spatchcocked, turkey cuts down on cooking time and makes it easier to get all parts to the proper degree of doneness.)