The sentence On va a la ___ pour apprendre means "One goes to the ___ to learn." The key phrase is pour apprendre (to learn/in order to learn), which identifies the purpose of going to this place.
The correct answer is ecole (school). A school is the institution specifically designed for learning and education. On va a l'ecole pour apprendre - One goes to school to learn.
The other places serve different primary purposes:
pharmacie (pharmacy) is where one goes to buy medicine
banque (bank) is where one goes to manage money
mairie (town hall/city hall) is where one goes for administrative and civic services
This type of question tests the ability to match places with their functions, a core vocabulary skill in French.