The form in g- was the more usual in Middle English manuscripts (gaile, also gaiole), from Old French gaiole "a cage; a prison," a variant spelling that seems to have been frequent in Old North French, which would have been the system familiar to Norman scribes. Now pronounced "jail" however it is spelled. Persistence of gaol (preferred in Britain) is "chiefly due to statutory and official tradition" [OED], and, probably, the fact that it is known the Americans spell it the other way.
In U.S. usually a place of confinement for petty offenders. The Medieval Latin word also is the source of Spanish gayola, Italian gabbiula.
see jail (n.), you tea-sodden football hooligan. Formerly in official use in Britain, and thus sometimes regarded in U.S. as a characteristic British spelling (though George Washington used it); by the time of OED 2nd edition (1980s) both spellings were considered correct there; the g- spelling is said to have been dominant longest in Australia.
[T]he very anomalous pronunciation of g soft before other vowels than e, i, & y ... is a strong argument for writing jail [Fowler]
"deceive or delude by flattery," 1640s, from French cajoler "to cajole, wheedle, coax," a word of uncertain origin; perhaps a blend of cageoler "to chatter like a jay" (16c., from gajole, southern diminutive of geai "jay;" see jay (n.)), and Old French gaioler "to cage, entice into a cage" (see jail (n.)). Related: Cajoled; cajoling.