The phrase Her Majesty's Government (His Majesty's Government during the reign of a male monarch) is a formal term referring to the government of a Commonwealth realm or one of its constituent provinces, states or territories. In use since at least the height of the British Empire, the phrase has been inherited and integrated into the countries that emerged from that polity and which remain Commonwealth realms.
In the British Empire, the term His (or Her) Majesty's Government was originally only used by the Imperial government in London. As the Empire developed, and responsible government was granted to more provinces and entities within the Empire some disambiguation of the term became necessary. In particular, the rise of Dominion status for various Imperial entities required some mechanism for describing how the Crown operated in different ways in different domains, with it eventually being described as "the Crown in right of [Canada, for example]". Various different entities within the Empire, whose interests were not always aligned (for instance, the Bering Sea Arbitration of 1893 pitted Canada against the United Kingdom over their somewhat differing relationships with America). From this, it became necessary to particularise the actions of specific entities through their executives. This became particularly important with the Statute of Westminster 1931, which effectively made the Dominions equal constituent countries with the United Kingdom in the imperial project. The transition of the Empire into the Commonwealth of Nations finalised the necessity.
Accordingly, from the 1920s and 1930s, the form His Majesty's Government in… began to be used by the United Kingdom and Dominion governments to differentiate between independent jurisdictions, such as His Majesty's Government in the Irish Free State. Colonial, state, and provincial governments, on the other hand, continued to use the lesser title Government of [region/territory], and eventually the phrase used in the former Dominions altered to mirror that of the UK, becoming, for example, Her Majesty's Australian Government.
Constitutional history and comparative terms
The term is employed in order to signify that the government of a Commonwealth realm or, less commonly, a division thereof (for instance the Canadian Province of Alberta), belongs to the reigning sovereign, and not to the cabinet or prime minister.
Notwithstanding that it is (in at least a technical sense) constitutionally incorrect, across the Commonwealth realms individual governments are frequently referred to informally by the person serving as the relevant Prime Minister, rather than in reference to the Monarch. For example, during Margaret Thatcher's time in office from 1979 to 1990, the Government of the United Kingdom was frequently known as the Thatcher Government. This style of referring to the government after its most important member is frequent across the Commonwealth, for example the Harper Government in Canada from 2006 to 2015 when Stephen Harper served as Prime Minister, or the Manley Government in Jamaica. It is, however, more constitutionally accurate to refer to such premierships as 'Ministries', for instance the Cameron Ministries where David Cameron was British Prime Minister from 2010 to 2016.
This convention of naming the Government after its most prominent members is comparatively modern. This is because until at least the reign of George III of the United Kingdom it was a Royal Prerogative that the Monarch held absolute discretion to choose their own ministers, such that the government wasn't really the Prime Minister's (or otherwise) at all. Indeed, during the reign of Queen Anne (just before the development of the office of Prime Minister) her fondness for compromise and consensus frequently led to governments composed by persons who disliked each other and did not integrate. In such period there was no question that the Government was anything other than that of the Monarch.
The evolution of the British constitution and reduction in the powers of the Crown gradually reduced the centrality of the monarch in de facto government. Queen Victoria was the last monarch truly to attempt to choose the personnel of her government; for instance her hatred of William Gladstone helped Lord Salisbury to retain office. Even at the time her actions were considered to be somewhat constitutionally improper. Although individual ministers (in Britain at least) below the rank of Prime Minister are still formally appointed by the Monarch, from the early twentieth century the head of state has in practice had no discretion to choose individual members of the government, except (occasionally) the Prime Minister. In the latter case this was only due to hung parliamentary arrangements, and (until the monarch's role was absolished in the 1960s) an unclear choice for leader of the Conservative Party. Indeed, where the monarch has had discretion to choose a Prime Minister in such circumstances it has resulted in some controversy: for instance, George V's role in facilitating the formation of the National Government of the United Kingdom in 1931 because Ramsay MacDonald operated a minority government was not without controversy, whilst in Australia Sir John Kerr's (acting in loco regis as Governor-General) discretion in dismissing ministers led to a constitutional crisis.
Thus, as the importance of the monarch in governance has declined, the term Her Majesty's Government has increased in formality and reduced in daily usage. As a corollary, the rise in power of the office of Prime Minister away from its historical position as primus inter pares (first amongst equals) of cabinet ministers in His/Her Majesty's Government into the driving force of a modern administration has led to governments named after them, and the two naming conventions serve different functions. For example, the reduction in the visibility of the monarch in government has made it an unhelpful description politically. If one were to critique the rail privatisation policy of the British Government during 1996 (for instance) it might not be considered helpful to use the phrase "Her Majesty's Government", since the Queen had no role in formulating the policy; instead the term "Major Government" is arguably more helpful, since the policy was driven by John Major.
Head of government in political science
In political science the term "Her Majesty's Government" is also deliberately avoided as being unhelpful: academic theorists deliberately use the term head of government to describe the relevant prime minister in those countries which use the Westminster system of government, where a distinction is made with the role of head of state (which is the monarch in the Commonwealth realms), as the two roles are split in such systems, in contrast to where they are unified, e.g. in the office of President of the United States of America. Ironically, therefore, in the United Kingdom, precisely because it has a constitutional monarchy, the prime minister is referred to as the head of government, even though they do not, in fact, occupy such that exact role because of the position of the monarch.
As with territories (for example the Canadian/Alberta example above), the monarchical possessive can also be devolved to individual departments and officers. For instance, Her Majesty's Railway Inspectorate regulates British train safety, whilst during his tenure in office John Howard was Her Majesty's Prime Minister for the Commonwealth of Australia. This particularised monarchical possessive can be further delineated by combining it with a territorial adjective to illustrate which right of the Crown has the possession, i.e. in what context is the Monarch acting, for instance as the Queen of Australia, Queen of New Zealand etc. This combination can be exampled by the passports issued to British citizens and others by the Crown in right of the United Kingdom, which begin on their first page with the phrase that "Her Britannic Majesty's Secretary of State Requests and requires in the Name of Her Majesty...". That is to say, it is the British Home Secretary making the request, not the British Government as a whole, and his request is only in the name of the British Queen, not as Queen of any other realm.