The same reason Mercia is in Britain.
This is a bit of Britain, around about 912 c.e.
There are six kingdoms and some strange Danelaw entity ("The Five Boroughs") on that map whereas now they are subsumed into one state. Mercia is now a vaguely defined region of Britain but, back then, was its own kingdom.
Way back then, though, just about everything
was local. Food, fuel and housing was
all produced locally. Trade between localities was tiny; mostly restricted to
some raw materials that couldn’t be produced locally and a few luxury goods
that other localities specialised in. The vast majority of Mercia’s needs were
produced by Mercia. Communications were similarly restricted, as was travel.
The self-sufficiency of Mercia was not desired but necessary; there simply wasn’t
the infrastructure to get goods from Wessex to Mercia, or an efficient means of
signalling your wishes.
In such a situation you can have your little kingdom. Decisions and actions of Wessex, barring sending hordes of heavily armed Devonians to pick a fight, have no consequence for Mercia and Mercia can live in isolation. It can have its own king, its own laws, even its own system of measurement.
If it weren’t for the Vikings, it would have been lovely.
But it wouldn’t have remained so.
Let us forward the clock to a time when trade amongst the localities had developed to the point where it was not correct to say that the locality met its needs on its own; the materials for its houses or the food and fuel it needed. Welsh slate for the roofs, York coal for the fire, and Wessex flour for the crumpets to toast on it. Could we then have had a king of Mercia, a Mercian road system, a Mercian law of contract? How would the Wessex farmers have coped with selling wheat in Mercian bushels to Mercia, hestawr to the Welsh? How would the Welsh have prepared slates to Mercian building regulations, and Northumbrian and East Anglian and all the rest? Would the road or the railway the Northumbrians used to transport their coal have been built if the building of it were an international project?
The lives of the people of Britain became so intertwined that the peoples of Mercia, Wessex, Gwynedd, Strathclyde, Kent, and all the other kingdoms were better served by a body that could act for all the diverse local kingdoms. And so, the (early) medieval local gave way to the modern national. With that, and with much upheaval, the Local Kingdom gave way to the Nation State.
The Nation State was, in many ways,
in a similar position to the Local Kingdom. Just about everything was national. Food,
fuel, housing, and manufactured goods where all produced nationally.
International trade was largely limited to raw materials and luxury goods. Decisions in one nation state could be taken
without affecting other nation states and, so, you could have your nation state.
If it weren’t for the frequent wars, it would have been lovely.
But it wouldn’t remain so.
Just as early modern life transcended the locality, modern life transcends the nation. Little is produced in any single place; industry is international. Major projects, infrastructure and research, are international. Economic competition is international. Decisions are constantly taken that affect the lives of all of Europe’s people. A modern European Nation State is no longer in the position similar to that of a Local Kingdom in early medieval times.
Britain is in the EU because the lives of the British people
are inextricably linked to the lives of the rest of the rest of the continent in
the same way that lives of Mercians are inextricably linked to the lives of
those in the rest of our island.