It is related to the word 'judge'. Some more etymology here: judge (n.)
mid-14c., "public officer appointed to administer the law" (early 13c. as a surname), also judge-man; from Old French juge, from Latin iudex "one who declares the law" (source also of Spanish juez, Italian giudice), a compound of ius "right, law" (see just (adj.)) + root of dicere "to say" (from PIE root *deik- "to show," also "pronounce solemnly").
Extended from late 14c. to persons to decide any sort of contest; from 1550s as "one qualified to pronounce opinion." In Jewish history, it refers to a war leader vested with temporary power (as in Book of Judges), from Latin iudex being used to translate Hebrew shophet.