“God Save the Queen”(or ‘King’ when there is one), is the national anthem of the United Kingdom, but only through customary use, and not by any declaration or act of Parliament.
When the sovereign is present, the entire anthem is played. For the rest of the royal family, only the first six bars, known as the “Vice Regal Salute” are given.
On an interesting side note: in Canada, which is still a British Commonwealth, governors general and lieutenant governors are saluted with the Vice Regal Salute followed by the first and last four bars of “O Canada.”
The origins of the phrases are many, but as early as 1545 the phrase “God save the King” was used as a naval watchword. The response expected to be heard was “Long to reign over us.”