You are lucky, you can visit Costa Brava any day of the year.
Summer for the beaches
Obviously, if you want to be in the sea or on the beach, then your best time to visit Costa Brava is in the summer. Avoid July and August because the typical tourist crowd that you see in Barcelona is all over Costa Brava beaches in the summer.
If you must come in July or August to Costa Brava, pick a secluded beach around Calella de Palafrugell, Begur, or Cadaqués.
Spring is the best
If you want to see the region of Costa Brava in peace, come before it gets too hot and before the crowds arrive. April is 20 degrees and May gets warmer and very nice and sunny.
Spring is also the best time of the year to walk a stretch of the coastal footpath of Cami de Ronda, from Blanes to Portbou.
Cami de Ronda connects the resorts and beaches of the region. You can walk from beach to beach. You can only do a small part of the entire route, for example Cap de Creus to Cadaqués or Llançà to Port de la Selva.
Spring is full of festivals. You must visit the outdoor concerts in Girona city. You must attend the famous "Temps de Flors" flower show that floods the city center. Outside Girona, there is the Palafrugell Spring Festival, a carnival with floats and parties from 21 - 23 May.
Winter for village hopping
With low crowds you can drive around Costa Brava at an easy pace. Winter is the best time of the year to really enjoy trips to the small towns of Blanes, Tossa de Mar, Sant Feliu de Guíxols and the Dali Triangle.
If swimming is your thing then winter is not the best time, but since it is not very cold you can still go out for a swim. Just be aware that some restaurants and bars are closed because of the low season. But you will never be short of places to eat. You will get fresh seafood at shacks along the coast, even at the beaches.
The carnival season - Starting in February, every part of Girona and Costa Brava starts celebrating the coming of spring. If you want to attend one, the carnival in Platja d’Aro is pretty cool.