Publication of an early version in The Gentleman's Magazine, October 1745. The title, on the contents page, is given as "God save our lord the king: A new song set for two voices".
When the ruling monarch is a queen instead of a king, the title of the anthem then becomes "God Save the Queen".
The tune for "God Save the King" was used in many countries as a national anthem. Apart from the German state, many of which were linked to Great Britain by marriage, Liechtenstein and Switzerland used the tune. Switzerland changed to a different tune in the 1960s. Liechtenstein still uses the tune.
The tune is also used in America. The famous American song "My Country Tis of Thee" was written in 1831 with the same tune. In the 1930s when the United States was choosing an official anthem the song was a popular choice. "The Star-Spangled Banner" was chosen instead of any other.
Que Dieu protège notre gracieux Roi,
Longue vie à notre noble Roi,
Que Dieu protège le Roi !
Rends-le victorieux,
Heureux et glorieux ;
Que soit long son règne sur nous,
Que Dieu protège le Roi !
Some people think that the origin of the song comes from the 1500s. The theory is that English composer, John Bull, created the tune of the song in the late 1500s. This idea is one of the more well supported origins of the tune.
King James Theory
Another idea is that the song was created in the 1620s for King James VI & I, but never played before being rediscovered in 1745 and changing 'God save great James our King' for 'God save great George our King'
French Theory
A popular idea in France is that the song is French, being written by Italian Composer, Jean Baptiste Lully. The theory is that Lully wrote the song, tune and words, for King Louis XIV of France, "The Sun King" in the 1680s, before George Fredrich Handel brought it to England. This idea is not fully evidenced, as much of the proof was shown to be fakes made in the 1800s.
1745 Theory
The most supported and proven answer is that the song was created by someone unknown in 1745 in England, and became famous throughout Great Britain.