Why did Kakashi kill Rin?
When they were on a mission in the Hidden Mist, the Hidden Mist ninja captured Rin and made her into the 3 tails' Jinchuuriki. Their purpose was for Rin to return to the village, where they'll undo the seal, kill Rin and have the 3 tails rampage on the Hidden Leaf.

Knowing that, Rin jumped in front of Kakashi's Chidori as he charged on a hidden Mist ninja to kill herself and foil their plans.

Obito came a second too late and only saw Rin getting impaled, but later on he too learned the whole story.

The Hidden Mist shinobi were manipulated by Madara. He was the one who set that plan up then told Obito so it could have awaken his power. Rin had a curse on her heart placed by Madara. 

Source: Naruto Manga - Chapter 675.