For a glimpse of the promise and problems of turning the electric grid green, there’s no better place to look than Hawaii.

With 21% of its power now coming from renewable sources like wind turbines and solar panels, Hawaii has become a laboratory for those intent on reinventing the grid. A new law mandates that renewables supply all of the state’s electricity by 2045.

But...