If you say because they had the best navy - why
1. Having a strong navy is very important in your ability to project power across the globe and the British had or had close to a navy as powerful as the next two most powerful navies combined . This allowed them to project power far better than any other power at the time
2. The UK is an island nation so for any country to successfully invade the UK they had to first defeat the royal navy and since no other navy came close , this meant the UK was close to impossible to invade . This meant they could focus more of their resources and energy in expanding and maintaining their empire while other European nations and to be constantly on guard for a potential invasion
I was asking more why they had a strong navy... being an island can't be the only reason.
They were wealthy and industrialized before anywhere else in the world. "In 1875, Britain accounted for 47% of world production of pig iron and almost 40% of steel." It's not exactly a great mystery.
There's that, but tbf British naval superiority dates back to much earlier than 1875. Of course a solid production base was key to maintaining it, but we have to recognize that the decision to put so many resources into shipbuilding was also a policy decision of British monarchs from the Tudors on (with precursors all the way back to Alfred the Great, but taking that aside). When it became clear that England's aspirations to become a European power had failed after the Hundred Years War, they gradually oriented themselves toward becoming a maritime power instead, and clearly this choice paid off big time.
Another factor beyond the British navy was colonial policy. Britain successfully incentivized significant settlement in its overseas colonies, something France for example never managed to get off the ground (until, well, Algeria...). This was the key reason for Britain's victory in the overseas fronts of the Seven Years War, thus wiping out its most important rival (Spain's star was already well on the wane by then).