Probably named after the magpie — a pie's mixed filling resembled the bird's nest of collected oddments.
A baked dish of fruit, meat, or vegetables with a top or base of pastry.
From Middle English pie, probably from pie 'magpie' — the assortment of ingredients inside a pie resembled the miscellaneous objects magpies collect in their nests. This etymology is widely accepted but not certain. Medieval pies were primarily savory, containing meats and spices
The dessert pie and the magpie bird are probably the same word. A pie's jumbled filling of diverse ingredients resembled the magpie's nest of collected trinkets — both are mixed collections inside a container.