Algae grows anywhere there is water and light, add some nutrients and it grows well. If you don't have live plants in the tank to use the nutrients and light, the algae grows even better.
Reduce the lighting time. If you don't have plants in the tank, you only need the light on for a few hours in the evening.
You can try growing live plants in the tank but the goldfish will probably eat them. However, that is good for them because goldfish do need plant matter in their diet.
If the goldfish are small you can try adding some glass shrimp. They pick at algae and might help remove some of it.
Chemicals designed to kill algae usually kill higher plants and are toxic to fish so it's preferable to try other safer alternatives before trying chemicals.