When the Swedish songwriter Ellen Berg first heard a K-pop track, in 2013, her reaction was typical of many Western listeners: “What the hell is this?” she recalled thinking.Berg, 31, was studying at Musikmakarna — a songwriting academy about 330 miles north of Stockholm — and her class had been asked to write a Korean hit.To get the aspiring songwriters in the mood, the students listened to “I Got a Boy” by Girls’ Generation, a wildly popular K-pop girl group. “It’s one of the craziest K-pop songs ever,” Berg said recently by phone. The track includes raps, bursts of high-speed dance music and even a verse in the style of a rock ballad. “It’s really five different songs in one,” Berg said.The class was given a week to write something like it. “It didn’t go very well,” Berg said, with a laugh.BTS performing during the American Music Awards in November in Los Angeles.Kevin Winter/Getty Images For MrcEight years later, Berg has certainly improved her K-pop songwriting abilities: She is now one of dozens of Swedish musicians who make a living exclusively from writing tracks for the genre. She has contributed to a hit for the pop juggernaut BTS, as well as to wildly successful tracks by groups like Red Velvet and Itzy.While Swedes have long been go-to figures for American pop stars — with songwriters like Max Martin and Shellback producing or co-writing tracks for Katy Perry, Taylor Swift, the Weeknd and others — Swedish musicians are now becoming a force in K-pop, too.Berg is signed to EKKO, a Korea-based music publisher with studios in Stockholm, where Berg works alongside Moa Carlebecker, a sought-after K-pop songwriter better known by her stage name, Cazzi Opeia. The two musicians (who collaborate under the name Sunshine) also regularly write with another duo — Ludvig Evers and Jonatan Gusmark, who call themselves Moonshine — based in a studio next door. Seven other Swedish songwriters who work on K-pop tracks have studios in the same building.Berg, Carlebecker, Evers and Gusmark first worked together in 2017 on “Peek-a-Boo,” a Red Velvet track that Berg likened to an old “Scooby-Doo” episode or a trip to a haunted house. “Peek-a-Boo” has since been streamed more than 217 million times on YouTube.EKKO is not the only company pumping out K-pop in Stockholm. Cosmos, a publisher, has seven songwriters working full time on K-pop tracks, Peo Nylen, its creative director, said in an email. The Kennel, another songwriting company, employs 14 K-pop writers, said Iggy Strange-Dahl, one of its founders.K-pop may seem like a recent phenomenon to Western music fans who caught on with the rise of BTS, but Korean record labels have been seeking out European songwriters since the late 1990s in a bid for global success, said Michael Fuhr, a German academic who wrote a book about K-pop. “They had Max Martin productions in mind,” he said, adding that the first successful European K-pop writers were actually Finnish and Norwegian, not Swedish.Today, songwriters of many nationalities are trying to make K-pop hits, Fuhr said, attracted, in part, by the fact that Koreans still buy CDs, so there is a lot of money to be made. SM Entertainment, a Korean entertainment conglomerate, says on its website that it works with 864 songwriters worldwide, including 451 across Europe and 210 in North America.Fuhr said that many K-pop hits were written at songwriting “camps” organized by record labels or publishers who invite musicians from across the world. Over multiple days, songwriters work in teams to create new songs. (American pop songs are also commonly written this way.)Gusmark, left, and Evers working in the studio. They perform together as Moonshine.Felix Odell for The New York TimesCarlebecker said in a video interview that she became hooked on K-pop when she first heard it, in 2016. As a child, she loved the Spice Girls, she said — “I had all the posters, I had all the CDs” — so K-pop instantly felt familiar, with its multitude of girl and boy groups in which each member has a uniquely defined personality.She immediately grasped that K-pop tracks must have multiple sections so each group member has a chance to shine, she said, whether they want to rap, sing softly or belt out a chorus. Having so many sections provides a lot more opportunities to be creative than on a typical Western pop song, she added.“There are no rules in K-pop — you can have three hooks, one after each other, if you feel like it,” Carlebecker said. “You can be crazy and colorful, and that’s what appealed the most.”Carlebecker, who is covered neck-to-toe in tattoos — a look that would be unlikely on an actual K-pop star — said she knew only two words of Korean: “annyeonghaseyo” (hello) and “gamsahabnida” (thank you).But that didn’t get in the way of her songwriting, she said: Carlebecker writes in English, and then Korean songwriters add new lyrics to her melodies, often keeping in a few random English words to help the track stand out.In interviews, Berg and Carlebecker offered multiple theories to explain why Swedes produce such good K-pop tracks, including the country’s strong songwriting tradition and comprehensive music education system. Sweden is cold, Berg noted, which meant that there was often “nothing better to do” than stay in and work on music.For some Koreans, the reason is actually quite simple: Swedes write melodies that are so catchy, fans want to sing them at packed stadium shows and at their local karaoke bars.“Swedes seem to have an emotional understanding of us Koreans,” Michelle Cho, a Korean songwriter who also scouts foreign songwriters for Korean record labels, said in a telephone interview. “They write melodies that seem to really hit our emotions.”Whatever the reason, as K-pop booms, competition among songwriters around the world is becoming fierce. Evers, of Moonshine, said that a few years ago, some songwriters in Sweden used to look down on his work as “a bit lame,” as though he’d failed to land gigs with American or European musicians and now had to ply his trade in Asia. Now, Evers said, those same people were coming up to him in bars saying, “We should write K-pop sometime!”Thanks to his success, he added, he was starting to get a tiny insight into the life of a K-pop idol. K-pop fans regularly contacted Moonshine on social media to praise the duo for its work, Evers said, and a popular K-pop YouTube channel has interviewed him.Swedish K-pop writers are getting noticed in Sweden, too. In November, Carlebecker was named “international success of the year” at Sweden’s annual songwriting awards, beating Max Martin (and Moonshine). Articles about the songwriters have appeared in the country’s major newspapers, and Berg and Carlebecker have been interviewed for TV news.Still, Evers said, not everyone has grasped just how significant K-pop is becoming for Sweden’s music industry.“My grandma still doesn’t understand what I do for a living,” Evers said. “She doesn’t think it’s real.” More