I was him (fui yo) + he killed him (lo mató) - the first person in the 1st part is clarifying the 3rd person in the 2nd part
I believe the quien is simply joining the two parts together just like in English.
I was the one who killed him
Fui yo quien lo mató