Gog is a leader, of a country, Magog, representing a country to the north of Israel that will attack Israel, culminating in the defeat of Magog and the return of Christ.
A second post-millenial battle is also described, using the term Gog and Magog to refer to the armies of Satan. This battle is describe in the book of Revelation. It is not completely clear why the Gog and Magog terminology is carried over to this context.