Warning: Spoilers Follow
The family Kreacher served was the "Ancient and Most Noble House of Black". When Sirius Black was the only member of the house of Black left, Kreacher had to serve him. The Black family was mostly made of evil dark wizards.
As Sirius Black was innocent and not a dark wizard like the rest of his family, Kreacher hated him. Kreacher seized his chance when Sirius told him to "get out". He left the house and went to a member of the Black family he still had respect for: Sirius's cousin Narcissa Black, also known as Narcissa Malfoy, the wife of Lucius Malfoy.
Lucius Malfoy, under orders from Lord Voldemort no doubt, told him that if Harry Potter were to contact the house by means of the Floo Network, he was to lie and say Sirius wasn't there. Since, Kreacher didn't belong to Harry he could lie to him without having to punish himself.
He turned up in the attic and Sirius was convinced he'd been there the whole time. He followed the plan and it succeded, Harry went to the Department of Mysteries. Sirius Black was killed in the struggle there, apparently ending the Black bloodline. The only known living descendants of the House of Black are Narcissa and her son Draco Malfoy, Bellatrix Lestrange and Nymphadora Tonks. Kreacher has refused to accept that Nymphadora Tonks is a member of the Black family as her line was ommited from the Black family tree and Lucius Malfoy and Bellatrix Lestrange were when last heard of prisoners in Azkaban. Whether Kreacher will seek to serve Narcissa and/or Draco, the only currently active members of the family, and so to transfer his allegiance to the House of Malfoy remains to be seen.