Alphabet Inc.’s secretive X moonshot lab is spinning off an energy-storage project with backing from billionaires including Jeff Bezos and Bill Gates.