He was an elite studio musician who played with A-list artists and helped write the Eric Clapton hit “Layla.” But his life was shattered by mental illness and a murder conviction.Jim Gordon, a talented but troubled drummer who was ubiquitous in the recording studios of the 1960s and ’70s and who, as a member of Eric Clapton’s band Derek and the Dominos, helped write the romantic ballad “Layla” — but who suffered from schizophrenia and spent nearly 40 years in prison, convicted of murdering his mother — died on Monday in a prison medical facility in Vacaville, Calif. He was 77.His death was announced by Robert Merlis, a publicist for Joel Selvin, the author of a forthcoming biography of Mr. Gordon. Mr. Selvin said he did not know the cause.“When people say that Jim Gordon is the greatest rock ’n’ roll drummer who ever lived,” Mr. Clapton wrote in “Clapton: The Autobiography” (2007), “I think it’s true, beyond anybody.”Tall and muscular, with a head full of curly hair, Mr. Gordon first attracted attention in 1963 on an English tour with the Everly Brothers. Over the next 15 years, he worked on studio recordings with A-list artists, including John Lennon (“Imagine”), George Harrison (“All Things Must Pass”), the Beach Boys (“Pet Sounds”), Harry Nilsson (“Nilsson Schmilsson”), Carly Simon (“No Secrets”) and Steely Dan (“Pretzel Logic”).As part of the informal group of elite Los Angeles studio musicians that came to be known as the Wrecking Crew, Mr. Gordon could book several sessions a day around the city. .He backed Joe Cocker on his “Mad Dogs & Englishmen” tour and performed with Alice Cooper and Frank Zappa, who nicknamed him Skippy for his All-American demeanor and his all-American looks. And for several months in 1971 he was a member of the British rock band Traffic.“He had a surgical, scientific skill on the drums,” Mr. Selvin said by phone, “and he had an extraordinary gift of intuition. Every time he played on a record, he brought something special to it.”After Mr. Gordon did a stint with the white soul band Delaney & Bonnie, with whom Mr. Clapton also recorded and toured, Mr. Gordon became a member of Derek and the Dominos, the band Mr. Clapton formed in 1970, along with the singer and keyboardist Bobby Whitlock and the bassist Carl Radle. The band released only one studio album, “Layla and Other Assorted Love Songs,” featuring Duane Allman on second guitar, in 1970.“Layla,” released as a single, rose to No. 51 on the Billboard Hot 100 chart the next year. The credit for writing “Layla” went to Mr. Clapton and Mr. Gordon, but its instrumental second movement, called the “Piano Exit,” was composed by Mr. Gordon and the singer Rita Coolidge, his girlfriend at the time. As she recalled in her autobiography, “Delta Lady” (2016, with Michael Walker), Mr. Gordon created a melody, to which she responded with a countermelody “that answered and resolved the tension of Jim’s chords and built to a dramatic crescendo.”Mr. Gordon and Ms. Coolidge made a cassette demo of what they intended to be a separate song and gave it to Mr. Clapton. Ms. Coolidge did not know what became of it until she heard “Layla” on the radio and learned that she had received no credit. She was infuriated.“What they’d clearly done,” she wrote, “ was take the song Jim and I had written, jettisoned the lyrics, and tacked it on to the end of Eric’s song.”When Mr. Clapton released the album “Unplugged” in 1992, his acoustic version of “Layla” peaked at No. 12 on the Billboard Hot 100. When “Layla” received the Grammy Award for best rock song the next year, Mr. Clapton and Mr. Gordon shared the award as songwriters, but Ms. Coolidge’s role received no acknowledgment.Derek and the Dominos around the time they recorded their one and only album, in 1970. From left: Eric Clapton, Bobby Whitlock, Mr. Gordon and Carl Radle.Michael Ochs Archives/Getty ImagesJames Beck Gordon was born on July 14, 1945, in Elizabeth, N.J., and grew up in Sherman Oaks, Calif. His father, John, was an accountant. His mother, Osa Marie (Beck) Gordon, was a pediatric nurse.As a boy, Jim made a set of drums from garbage cans and played them until his parents bought him a drum kit. He started performing professionally as a teenager. In 1963, he was playing with Frankie Knight and the Jesters when Joey Paige, the bassist for the Everly Brothers, scouted him at a club on the Sunset Strip in Los Angeles. Soon Jim, at just 17, was off to England with the Everly Brothers for a tour that also included Little Richard and Bo Diddley.At some point during the next 15 years, Mr. Gordon started hearing voices — most menacingly and hauntingly, that of his mother — and displaying erratic behavior. He interrupted a recording session by telling his fellow musicians, “You’re the devil”; he punched Ms. Coolidge in the eye with such force that she was lifted off the floor and slammed into a wall.The sound of his mother’s insistent voice in his head tormented him, causing him pain and leaving his unable to play his drums, according to an article in The Philadelphia Inquirer in 1994. He was treated at hospitals. Work dried up, but he was able to get by on the royalties from “Layla.”“The symptoms were getting so powerful, starting about 1975 and 1976,” said Mr. Selvin, a former pop music critic for The San Francisco Chronicle. “It was an extraordinary battle. Command hallucinations are the most extreme in all of mental illness.”Mr. Gordon was also taking drugs. “I guess I was an alcoholic,” he told Rolling Stone in 1985. “Before, I was drinking every night, but I wasn’t getting up in the morning for a drink; I would put a needle in my arm. When I stopped taking the heroin, I began to drink all day.”On the night of June 3, 1983, he attacked his mother at her home in North Hollywood, first banging her head with a hammer and then stabbing her with a knife. “When I remember the crime, it’s like a dream,” he told The Inquirer. “I can remember going through what happened in that space and time, and it seems kind of detached, like I was going through it on some other plane. It didn’t seem real.”He told Rolling Stone that he had felt that he was “being guided like a zombie.”He was found guilty of second-degree murder. Despite having been diagnosed as an acute paranoid schizophrenic, he did not qualify for an insanity defense based on California law at the time. He was sentenced in 1984 to 16 years to life and later denied parole several times.“This is not a murder case,” Scott Furstman, Mr. Gordon’s lawyer, told The Los Angeles Times after the verdict. “This case is a tragedy.”Mr. Gordon is survived by his daughter, Amy, and his brother, John Jr. His marriages to Jill Barabe and Renee Armand ended in divorce. More