There are two major causes of algae growth in a tank... Too much waste and too much light.
Both fish food and fish waste act like fertilizer, so by gravel vacuuming/ doing water changes, you keep the amount of waste down so the algae has less "food" to grow with.
As far as lighting goes, whether its natural sunlight or just tank lighting, the more you have of it, the more algae is going to grow. Usually I suggest no more than 8-10 hours of direct light per day... I say "direct light" because I've had people ask if that means they can't turn lights on that are in the same room as the tank!