The story
First attested in the plural in October 1644 and in the singular in 1683; Latin: custōs (“guard”, “protector”; “guardian”; “keeper”, “custodian”) + rēgnī (“of royal power”; genitive singular of rēgnum, “royal power”, “kingdom”) = “custodian of royal power” ≈ “guardian of the realm”.
Etymology from Wiktionary, CC BY-SA 4.0.