Potatoes will often go green when they’re not stored properly and they’re exposed to light.
This is due to formation of chlorophyll (which is found in all green plants). However, as potatoes turn green they also form a a toxin called solanine. The green colour is an indicator that solanine levels may be reaching a level that is harmful to humans.
All over greening is typically caused when potatoes are improperly stored at home or sit on display at your grocery store . While the bright lights make it easy to shop and the produce look beautiful, those same lights cause the potatoes to start turning green.
That said, you are unlikely to ingest enough solanine from eating green potatoes to do you any serious harm.
If you are worried about wasting food, you can peel away the greening (a little won’t hurt) and use the potatoes as you normally would. However, if these potatoes taste bitter after peeling, then it’s best not to eat them.
Snopes has a very good article on the subject. Are Green Potatoes Poisonous?