The term "United Kingdom" originated with the Acts of Union 1707, which united the Kingdom of England and the Kingdom of Scotland into a single sovereign state: the Kingdom of Great Britain. The term was first used officially in the Treaty of Union, ratified by both parliaments in 1707.
It reflected a union of two distinct kingdoms under one monarch, each retaining its own legal system, church, and education system. In 1801, the Kingdom of Ireland was added, forming the "United Kingdom of Great Britain and Ireland." After Irish independence (1922), the name became the "United Kingdom of Great Britain and Northern Ireland"—the official name today.
"Great Britain" refers geographically to the island containing England, Scotland, and Wales, while "United Kingdom" is the political entity including Northern Ireland.