Demon Slayer: Kimetsu no Yaiba began like any good story should: with the gruesome massacre of an entire family, largely made up of children. When Tanjiro Kamado returned home to discover the majority of his family dead and his sister Nezuko transformed into a demon, he made it his life's quest to find the demon who had converted them all into demons. After joining the Demon Slayer Corps, Tanjiro ran across Muzan Kibutsuji when touring the city of Asakusa a few years later. Tanjiro was there when Muzan's scent verified that he was the demon who had massacred the Kamado family. But why did the Original, Progenitor, and King of Demons choose to slaughter a random mountain family?
Despite the fact that Muzan Kibutsuji is a terrible demon who has lived 1,000 years and slaughtered thousands of people, he has a rather sympathetic motivation: he doesn't want to die. Muzan was dying of disease when a doctor in Japan's Heian era utilized the enigmatic Blue Spider Lily to transform him into the world's first demon. Muzan immediately realized, however, that despite his great abilities, he would perish if exposed to sunlight. Muzan found having to stay indoors during the day humiliating, and he spent the rest of his long life trying to figure out how to become the perfect being impervious to death.
Muzan's greatest dread, aside from the sun, is Sun-Breathing, the first and most powerful Breathing Style utilized by Demon Slayers to combat demons. Muzan has been physically and psychologically wounded since Yoriichi Tsugikuni, the first swordsman to use Breathing Styles, nearly murdered him with Sun-Breathing. Muzan went to tremendous efforts to exterminate Sun-Breathing. Muzan and his most powerful demon journeyed around Japan with Kokushibo, Upper-Rank One of the Twelve Kizuki and Yoriichi's brother, slaying anybody who had even heard of Sun-Breathing. The only individuals they missed were Muzan's ancestors, the Kamados, who Muzan would slay at the start of Demon Slayer.
Fans speculated for a time that Muzan killed the Kamados because he'd discovered they were passing down Sun-Breathing as the Hinokami Kagura. Tanjuro Kamado, Tanjiro's and Nezuko's father, had already passed away, which was fortunate for Muzan because Tanjuro was a great master of the Hinokami Kagura. However, in the manga's final arc, "Sunrise Countdown," a flashback from Nezuko's point of view about the attack showed that Muzan's purpose for massacring the Kamado family was unconnected to Sun-Breathing and ultimately a successful stratagem.
Muzan Kibutsuji despises demons because he is the one who made them all. Muzan's only motivation for continuing to create demons, despite his objections, was the hope that one of them would gain the capacity to endure sunlight. Muzan injected each of the Kamado family members with a big dosage of his blood, anticipating that the sheer power they'd receive from him would result in the birth of a demon capable of walking in the sun. Nezuko was the only one who survived the amount of blood Muzan gave them, and she did survive getting caught in the sun's death rays at the end of the manga's "Swordsmith Village" arc.
Muzan's choice of the Kamados was never explained in the Demon Slayer manga, thus it's possible that the eradication of Sun-Breathing was a two-birds-one-stone situation. Perhaps he figured no one would notice if the Kamados vanished, given his inclination for keeping a low profile in the first place. Muzan could earn the ability to endure exposure to the sun by producing a demon that could do so, and then consuming that demon. Muzan's experiment on Nezuko went exactly as planned, but he made the mistake of messing with the wrong family, as Tanjiro's joining the Demon Slayer Corps ultimately led to Muzan's defeat and death.