Motivated by possible applications within the framework of anti-de Sitter gravity/Conformal Field Theory (AdS/CFT) correspondence, charged black holes with AdS asymptotics, which are solutions to Einstein-Gauss-Bonnet gravity in D dimensions, and whose electric field is described by a nonlinear electrodynamics (NED) are studied. For a topological static black hole ansatz, the field equations are exactly solved in terms of the electromagnetic stress tensor for an arbitrary NED Lagrangian, in any dimension D and for arbitrary positive values of Gauss-Bonnet coupling. In particular, this procedure reproduces the black hole metric in Born-Infeld and conformally invariant electrodynamics previously found in the literature. Altogether, it extends to D>4 the four-dimensional solution obtained by Soleng in logarithmic electrodynamics, which comes from vacuum polarization effects. Fall-off conditions for the electromagnetic field that ensure the finiteness of the electric charge are also discussed. The black hole mass and vacuum energy as conserved quantities associated to an asymptotic timelike Killing vector are computed using a background-independent regularization of the gravitational action based on the addition of counterterms which are a given polynomial in the intrinsic and extrinsic curvatures.