The etymology of the word is unknown, but may be related to the magpie (also called "pie"), perhaps because both were spotted, or because the bird collects miscellaneous articles, and almost anything can be wrapped in pastry and cooked.
The origin of the term is unknown, yet it might be linked to the magpie (often called a pie), either because they are frequently observed together or because the bird gathers miscellaneous items and wraps them in pastry for cooking.