Since Samuel is the first major character introduced in the book, his name was chosen as its title. Although the events of 2 Samuel all transpired after Samuel’s death and that book contains no mentions of his name, it also bears his name as its title. Why? Second Samuel is named after Samuel because 1 and 2 Samuel were originally one book. When the book’s length (especially in its Greek translation, the LXX) was too great for a single scroll, it was divided approximately in half; the second half did not receive a new name but was marked as part two.
In their ancient Greek translations, these books carry different titles: 1 and 2 Samuel are known there as “1 Kingdoms” and “2 Kingdoms,” continued by “3 Kingdoms” (= 1 Kings) and “4 Kingdoms” (= 2 Kings). This titling minimizes any difference between the four books that chronicle the course of the ancient Israelite monarchy from its beginning with Saul until its termination at the Babylonian exile.
From Hoffner, H. A., Jr. (2015). 1 & 2 Samuel. (H. W. House & W. Barrick, Eds.). Bellingham, WA: Lexham Press.