1530s, "end point of a race," of uncertain origin. The noun gol appears once before this, in a poem from early 14c. and with an apparent sense of "boundary, limit." Perhaps from Old English *gal "obstacle, barrier," a word implied by gælan "to hinder." Or from Old French gaule "a pole," from Germanic; or a figurative use of Middle English gale "a way, course." Sports sense of "place where the ball is put to score" is attested from 1540s. Figurative sense of "object of an effort" is from 1540s.
knock someone for a loop