WARNING: The following contains major spoilers for the Demon Slayer: Kimetsu no Yaiba manga, by Koyoharu Gotouge, available in English through Viz Media.
Demon Slayer: Kimetsu no Yaiba started off the way any great story does: with the brutal slaughter of an entire family comprised mostly of children. When Tanjiro Kamado returned home to find most of his family dead and his sister Nezuko turned into a demon, he made it his life's mission to track down the demon responsible. A few years later, after Tanjiro had joined the Demon Slayer Corps, he encountered Muzan Kibutsuji while visiting the city of Asakusa. It was there that Tanjiro confirmed by Muzan's scent that he was the demon who'd massacred the Kamado family. But why did the Original, Progenitor and King of Demons decide to butcher some random family living in the mountains?
Muzan Kibutsuji, despite being an evil demon who's lived 1,000 years and murdered thousands of people along the way, has a pretty relatable motivation -- he doesn't want to die. Muzan was dying of illness when a doctor in Japan's Heian era used the mysterious Blue Spider Lily to turn the ailing Muzan into the first demon. However, Muzan quickly realized that although he had gained incredible powers, he would die if he was exposed to sunlight. Muzan found it humiliating to have to stay indoors during the day and spent the rest of his prolonged life searching for a way to become the perfect being immune to death.
Other than the sun, Muzan's biggest fear is Sun-Breathing, the original and most powerful Breathing Style used by Demon Slayers to battle demons. Yoriichi Tsugikuni, the first swordsmen to ever use Breathing Styles, once nearly killed Muzan with Sun-Breathing, and Muzan has been both physically and psychologically scarred ever since. Muzan went to great lengths to ensure Sun-Breathing was wiped out. Partnering with Kokushibo, Upper-Rank One of the Twelve Kizuki and the brother of Yoriichi, Muzan and his most powerful demon traveled around Japan, killing anyone who'd even heard of Sun-Breathing. The only people they missed were the ancestors of the very same family Muzan would slaughter at the beginning of Demon Slayer -- the Kamados.
For a while, it was suspected by fans that the reason that Muzan had killed the Kamados was that he'd somehow learned that they had been passing down Sun-Breathing as the Hinokami Kagura. It was fortunate for Muzan that Tanjuro Kamado, Tanjiro's and Nezuko's father, had already passed away because Tanjuro was a true master of the Hinokami Kagura. However, a flashback from Nezuko's POV regarding the attack in the manga's final arc, "Sunrise Countdown," confirmed that Muzan's motivation for massacring the Kamado family was unrelated to Sun-Breathing, and ultimately a successful ploy.
Muzan Kibutsuji hates demons for having created each and every one of them. As it turned out, the only reason Muzan kept creating demons, even though he didn't want to, was in the hope that one of them would develop the ability to withstand sunlight. When Muzan killed the Kamado family, he injected each of them with a massive dose of his blood, hoping that the sheer power they'd get from him would birth a demon capable of walking in the sun. Nezuko was the only one who survived the amount of blood Muzan gave them, and at the end of the manga's "Swordsmith Village" arc, Nezuko did indeed survive being caught in the sun's lethal rays.
Demon Slayer's manga never confirmed why Muzan chose the Kamados specifically, so perhaps it was a two-birds-one-stone situation with the elimination of Sun-Breathing. Maybe he just assumed no one would notice if the Kamados disappeared, considering his preference for keeping a low profile anyway. By creating a demon who could survive exposure to the sun, Muzan would then only need to consume that demon to gain the ability for himself. Muzan's experiment on Nezuko worked out exactly as he'd hoped, but unfortunately for him, he picked the wrong family to mess with, as Tanjiro joining the Demon Slayer Corps is what ultimately led to Muzan's defeat and death.