Are we talking baout the language or the country? Both happen over time as people tend to live together and become isolated from other outside influences. One it begins to grow then others are attracted to it and it perpetuates itself, more speople speak it or live in an area and it takes on its own customs until, the area where this group lives takes a name. The Britons lived in the British Isles, so those islands of Europe became known eventually (after a few different names) as Britain. There was also the acti of Union in 1701 which may have formalised it too.
The word British goes back a long way. The oldest known use of it was the word Pretani, which was a Greek word, used by the Greek explorer Pytheas (whose name I had to look up!) in the 4th century BCE. (According to Wikipedia, the words Prettanike or Brettaniai were used).
Anyway, after the Romans invaded, they called their new province Britannia and the people of that land (the Celtic people already living there) the Britons.
As new people arrived, they would also adopt the name. Maybe not at first, but eventually. So, even the descendants of Anglo-Saxons (who moved in from what is today Germany) would end up using the term.
Today, “British” is a term that is used for anyone from the United Kingdom – especially the largest island (Great Britain). It can apply to those of Celtic descent as well as recent immigrants from places like South America or China if they have UK citizenship. It is certainly easier to say “I’m British” than “I’m a citizen of the United Kingdom of Great Britain and Northern Ireland”, which is what they often mean!
The word “British” certainly has a long and complicated history. Thanks for asking this question and making us think about it.