They don’t speak Castillion Spainish in Barcelona, they speak Catalon.
They do speak Spanish -Castillian in Barcelona, as there are plenty of non-Catalan immigrants from the rest of Spain there, as also many foreigners who rarely speak Catalan. It is a fairly cosmopolitan place.
Catalan is also a fairly recently revived language. A hundred years ago it was mainly spoken in rural villages, the cities being mainly Spanish speaking. It’s only recently that its been revived as a vehicle for nationalism.
A great-uncle came from Barcelona in the 1920s, with impeccable Catalan ancestry, and he spoke no Catalan. That’s how it was.
Part of the Catalan nationalism thing is a reaction to foreigners (Spanish from elsewhere as well as non-Spaniards such as Eastern Europeans, etc.) swamping the locals.