MELBOURNE, Australia—Tesla Inc.’s Elon Musk has agreed to build the world’s largest lithium-ion battery system in Australia, an ambitious project that he hopes will show how the technology can help solve energy problems. The plan is to build a 100-megawatt storage system in the state of South Australia—which has been hit by a string of blackouts over the past year—that will collect power generated by a wind farm built by French…