The Queen of the UK being head of state of Canada and Canada's allegiance to her is simply a legal device whereby Canada can maintain her historic ties to the Crown. The Queen of the UK is also legally Queen of Canada (as per the Royal Styles and Titles Act) and is represented in Canada by the Governor General, who exercises all powers, authorities and functions belonging to the Queen in right of Canada. Canada is a sovereign nation, in no way legally or politically subordinate to the UK. With a few exceptions made at Canada`s request (amendment of the constitution and judicial appeals to the Imperial Privy Council, for example), this has been the case since the passage of the Statute of Westminster in 1931 (judicial appeals and some constitutional amendments were patriated in 1949; full constutional amending powers in 1982).
The position of the Governor General in the governance of Canada is somewhat similar to the position of a president in a parliamentary republic like Germany, Italy, Ireland, India, etc.
You might like to read the ``Letters Patent Establishing the Office of Governor General and Commander-in-Chief of and over Canada`` (sorry, I don`t have a copy at hand). These have been issued in 1878, 1905, 1931 and 1947, defining the office and powers of the Governor General. The office is not established by the Constitution Acts of 1867 or 1982, but by these Letters Patent.
Apologies for such a long reply.