In October 2011, bassist Robert Trujillo said that the band had returned to the studio to begin writing new material. He said: "The writing process for the new Metallica album has begun. We've been in the studio with Rick Rubin, working on a couple of things, and we're going to be recording during most of next year". In an interview with Classic Rock on January 8, 2013, Lars Ulrich said regarding the album, "What we're doing now certainly sounds like a continuation [of Death Magnetic]". He also said, "I love Rick [Rubin]. We all love Rick. We're in touch with Rick constantly. We'll see where it goes. It would stun me if the record came out in 2013". In a July 2013 interview, Ulrich told Ultimate Guitar, "2014 will be all about making a new Metallica record"; he said the album would most likely be released during 2015. Trujillo and Kirk Hammett later confirmed the band's intention to enter the studio.
In March 2014, Metallica began a tour called "Metallica By Request", in which fans requested songs for the band to perform, and a new song, titled "Lords of Summer", was written for the concerts and released as a "first take" demo in March 2014. A Black Friday exclusive single featuring the "First Pass Version" and a live version limited to 4,000 copies was released later that year on vinyl. In March 2015, Ulrich told Rolling Stone that twenty songs had been written for the album, and that he hoped some of them could be played at their shows later in the year. In October 2015, the band unveiled a new website with an introduction from Ulrich containing footage from the studio of the band working on new material. In November, Hammett said that the album was expected to be released in late 2016 or early 2017.
On February 6, 2016, during their "The Night Before" show at AT&T Park prior to Super Bowl 50, James Hetfield said that the band was nearing the end of the recording process, and Ulrich said that the album would be released soon. This was compounded by the band playing a new riff at the show, which ended up being from the song "Murder One". Ulrich further elaborated in March 2016 when he said that the band hoped to finish production of the album during the spring. "I think  will be a pretty in-your-face year, at least the back half of it... hopefully we should be able to knock that on the head (finishing the album) this spring, I would guess". In March 2016, Hammett said that the band had worked with Greg Fidelman, who engineered and mixed Death Magnetic, as producer on the new album. "The title 'producer' itself is a bit ambiguous. It differs from person to person. You can call Rick Rubin a producer, but he's not the [same] type of producer as Bob Rock, who is there for every note. At the same time, Rick Rubin gets stuff done. Greg Fidelman is a different type of producer in that he's with the engineer always looking to try and move the project forward."
In April 2016, during the week leading up to Record Store Day, for which the band was its ambassador for 2016, Ulrich told Billboard that the band's expanded role within the music industry had played a part in the amount of time that it had taken to write and record the album. "The way we do things now is very different than the way we did things back in the days of Kill 'Em All and Ride the Lightning. Nowadays we like to do so many different things." Ulrich was also optimistic that production of the album had almost reached its completion. "Unless something radical happens it would be difficult for me to believe that it won't come out in 2016". In May 2016, Ulrich said in an interview with Metal Forces that the album would be released in the summer of 2016, and that details for the new album would be finalized in the next month. "If the record doesn't come out this year then it won't be because it’s not done... it will be because there's some sort of cosmic reason that it would be smarter to hold onto it until next year. But the record will be done this summer". Recording of the album was completed in June 2016 once the recording for the song "Hardwired" was finished.
Hardwired... to Self-Destruct marks the first studio album by the band not to feature songwriting contributions from Hammett since he joined the band in 1983 prior to the recording of Kill 'Em All. In 2014, Hammett had lost his phone at Copenhagen Airport, which contained almost 250 riff ideas. Since Hammett did not back up the data, it affected his creative input for the new album and he "had to start at zero again while [Hetfield and Ulrich] had material for songs". Trujillo's sole writing credit on the album was the introduction to "ManUNkind", which he later said was written as a tribute to former Metallica bassist Cliff Burton. Regarding lyrical themes, Hardwired... to Self-Destruct bemoans the music industry on "Moth Into Flame" and subjects such as drug addiction and overdose on "Hardwired". Familial lyrics dealing with the H. P. Lovecraft Cthulhu Mythos are explored on "Dream No More", and "Murder One" serves as a tribute to the late Motörhead frontman Lemmy, who died in December 2015; the song was named after the bassist's favorite amplifier.