Gavi borders the following municipalities: Arquata Scrivia, Bosio, Carrosio, Francavilla Bisio, Isola del Cantone, Novi Ligure, Parodi Ligure, San Cristoforo, Serravalle Scrivia, Tassarolo, and Voltaggio.
The area of Gavi was already settled in Neolithic times; later it perhaps housed a Roman military outpost defending the Via Postumia.
According to the legend, the current name would derive from that of a princess of the latter, Gavia or Gavina, who had established herself in a castle here.
Later in the Middle Ages the town was under the Marquisses of Gavi, allied with Frederick Barbarossa, who took refuge here after the Battle of Legnano.
In 1625, during the First Genoese–Savoyard War, it was attacked and stormed by French-Savoy troops, but the Genoese retook it after only 21 days.