BEVERLY HILLS, CALIF. — In February 2015, Gwen Stefani joined Maroon 5 onstage at the Grammys to perform the ballad “My Heart Is Open.” After the awards, she got Mexican food with the band’s singer, Adam Levine, a fellow coach on the NBC reality-singing competition “The Voice.” For a pop superstar of two decades, it was a relatively normal night. But when she woke up the next morning, “My life was literally blown up into my face,” she said.

For 10 weeks, those closest to her had known the secret that ultimately ended her 13-year marriage to Gavin Rossdale, the singer of the band Bush. Ms. Stefani won’t discuss the details, partly to protect her children, but said: “If I could, I would just tell you everything, and you would just be in shock. It’s a really good, juicy story.” (The tabloids say Mr. Rossdale was having a several-years-long affair with a nanny caring for the couple’s three sons.)

Ms. Stefani, 46, was reeling. “I’m gonna die,” she said, recalling her emotional state. “I am dead, actually. How do I save myself? What am I going to do? How do I not go down like this?”

Sitting at the long marble table in an office in her sprawling home here, dressed in a sheer white blouse and shiny red stilettos, Ms. Stefani laid out the answer: She plunged herself into her first love, songwriting. “I have to make music out of this. That’s what God wants for me,” she remembers thinking.