From Medieval Ashkenazi Aramaic חד גדיא (khád gádya, “one kid”). In the sense of "prison", it is related to Polish koza (“goat”), which is also used for "prison".
חד־גדיא • (khadgadye) m