Uncertain. Has been linked to Runic ᛃ(/j/), uncial Latin G, and even to a cursive Ancient GreekΞ(X/ks/). Snædal favours the Latin origin.[1] Latin ⟨g⟩ was indeed used for /j/ in various medieval languages. The Gothic letter may have been invented after Wulfila.
^ Snædal, Magnús, Gothic contact with Latin: Gotica Parisina and Wulfila’s alphabet, in: Askedal, J.O. & Nielsen, H.F. (ed.), Early Germanic languages in contact, Amsterdam, 2015, pp. 91-108, especially 100-101.