National flag of the United Kingdom is called Union Jack or Union Flag. Beside in the United Kingdom it also has official or semi-official status in some Commonwealth realms and some British overseas territories. Some nations that are former British colonies use Union Jack in the Upper left corner of their flags.
The first Union Jack was designed in 1606 after James VI of Scotland inherited the English and Irish thrones as James I in 1603 an with that uniting the crowns of England, Scotland in a personal union. It was designed as a combination of the Flag of England (St. Georges Cross - red cross on a white background) and the Flag of Scotland (St Andrew's Cross - white saltire on a blue background) which formed the flag of Great Britain. When in 1801 were united Kingdom of Great Britain and the Kingdom of Ireland to create the United Kingdom of Great Britain and Ireland, a new Union Jack is designed, a combination of flag of of three older national flags: the red cross of St George for England and Wales, the white saltire of St Andrew for Scotland, and the red saltire of Saint Patrick's Flag of Ireland.
Flag was first supposed to be used as a jack at sea on military and civilian ships while land forces were to use flags of their nations. In 1634, King Charles I ordered for flag to be used only on royal ships. After the Acts of Union 1707 were passed flag became the official flag of Kingdom of Great Britain and land forces started using it as well, but with a lighter blue field to more resemble flag of Scotland. After unification of Kingdom of Great Britain and the Kingdom of Ireland in 1801, flag was declared Royal Flag and flown on all the King's forts and castles but nowhere else.
There is no law that makes Union Jack a national flag of the United Kingdom but it became a national flag through precedent and tradition. First written mentioning of Union Jack as a national flag comes from 1908 when it was stated in Parliament that it should be regarded as such. It is , of course, more an official flag of the monarchy than of an union. Its civilian used is now permitted on land, but use at sea that is not naval or military is not allowed. Order that forbids use of Union Jack for civil ships is given in 17th century when the flag was used to avoid paying harbor duties which was a privilege of naval ships. From 1993 it is a criminal offence to display Union Flag from a British merchant or civilian ship if it’s not a Pilot Jack (Union Jack with white borders). Instead of Union Flag, naval ships fly white ensign, private and merchant boats fly red ensign and boats with special permission fly blue ensign. This ensigns contain the Union Flag as part of the design in upper left corner.
Today Union Jack is also flown above Buckingham Palace, Windsor Castle and Sandringham when The Queen is not in residence.