It was many years ago but that is what I did. After having seeing Galapagos 3D on IMAX, I was amazed and wanted to go to the Galapagos and to experience it fully and make diving part of the experience, despite having never dived before.
The main consideration is how much time you have in the Galapagos. I only had three weeks there and so I took my course at home in Canada. However, I did not want to take the test here because the water is always damn cold and that did not sound fun at all! So, I passed the practical test in the Galapagos after having passed the theoretical in Canada and taking 1 class per week for 2 months IIRC. There are probably accelerated courses which you can take every day but I still expect 1 or 2 weeks before you are ready to dive.
If you were to spend longer in the Galapagos, say over a month, then you could do the whole thing there. Take classes and explore the islands at first and then go on diving excursions once you are certified. Otherwise, get started at home and have the diving place where you learn give you the list of affiliated ones in the Galapagos. When you arrive, go visit them and speak to the personel. They are almost all certainly located nearby in Puerto Ayora which is the main town. That is how I chose the right one. An important criteria is to see how well the instructor available speaks a language you understand.
EDIT: While I see you have broadened the title to include all of Ecuador, I can tell you that if you can be in the Galapagos it will be the best place to dive. Diving and even snorkeling are extremely impressive. I took my exam with Scuba Iguana in Puerto Ayora but since it was years ago, they instructors may have changed.
On the mainland, there are dive sites around Machalilla national park and Isla La Plata, known locally as Poor Man's Galapagos. If you are there already for an extended period you can look for a certified diving school, otherwise just enjoy the park there. It is very nice and I've been to it several times while I lived in Ecuador one year.