The word afanaban is the imperfect form of afanar in the third person plural.
See the full afanar conjugation

afanar

La idea del juego surgió cuando los dos aprendices se afanaban entre los vericuetos de la programación en C.
The idea for the game came about as the two trainees were busy tackling the ins and outs of C programming.
Las familias se afanaban en cuidarme, desde alimentarme en los torneos hasta llevarme en carro a las prácticas.
The judo families pitched in to take care of me, from feeding me at the tournaments to giving me rides to practice.
Una pequeña asamblea de frailes y peregrinos esperaban el inicio de la ceremonia, mientras que otros frailes se afanaban en ultimar los preparativos.
A small congregation of friars and pilgrims awaited beginning of the ceremony. Meanwhile, other friars were busy with the final preparations.
Abajo, cerca del coche, dos hombres se afanaban en un trabajo indescifrable.
Down near the car, two men were busy indecipherable work.
Cientos de obreros de toda Andalucía, en turnos diarios de ocho horas por los que cobraban un jornal de una peseta, se afanaban en la construcción.
Hundreds of workmen from all over Andalusia, working daily eight hour shifts for which they received a daily wage of one peseta, toiled on the construction of the railway.
Want to Learn Spanish?
Spanish learning for everyone. For free.
SpanishDict Premium
Have you tried it yet? Here's what's included:
Cheat sheets
No ads
Learn offline on iOS
Fun phrasebooks
Learn Spanish faster
Support SpanishDict