1809, probably a playful elaboration of gallant in an obsolete verbal sense of "play the gallant, flirt, gad about." Related: Gallivanted; gallivanting.
Young Lobski said to his ugly wife,
"I'm off till to-morrow to fish, my life;"
Says Mrs. Lobski, "I'm sure you a'nt",
But you brute you are going to gallivant."
What Mrs. Lobski said was right,
Gay Mr. Lobski was out all night.
He ne'er went to fish, 'tis known very well
But where he went I shall not tell.
["Songs from the Exile," in "Literary Panorama," London, 1809]