There are two stories about them. One of them says that about 20 years ago they escaped from the zoo but liked it in the parks so much that they decided to stay.
Another story says that they were very popular pets in the 70’s but as they are very noisy the owners let them out and the population of 50 has quickly become 2000, and then more.
Whichever story is true they are actually a big problem here in Spain. They are not only in Barcelona but also in Madrid, Tarragona and had even spread on the Balearic Islands.
They are VERY noisy and eat everything that they see causing a lot of problems for farmers. They are also threatening the other native bird spices. There is a very good BBC article about them here.