Dobby was a house-elf for the Malfoy family at Malfoy Manor. Dobby was resented by the Malfoys and the feeling was mutual as they tortured. However after the events of the Chamber of Secrets, Harry Potter had set Dobby free by placing his sock in a book that Lucius Malfoy then gave to Dobby.
After having been set free he was unemployed and got bored quickly. He later found employment at Hogwarts School of Witchcraft and Wizardry. His contract was very loose and Dobby requested that he be paid for his work, something no other house-elf dared to do.
Other notable things Dobby has contributed towards was the discovery of the Room and Requirement. In the films it is Neville Longbottom who discovers it however in the books it is Dobby who tells Dumbledor’s Army about the room.
More popular things Dobby has helped in was when Harry, Ron and Hermione were trapped in Malfoy Manor after being captured by Snatchers.They were trapped in their dungeons when Dobby was able to Apperate in and out of the room aiding in Luna and the goblin in escaping also. However more tragic events later occurred as when he tried to help Harry Potter in escaping a fatal blow by Bellatrix’s knife impaled itself in Dobby. His last words were “Harry… Potter.”