In the sense you are talking about here, articles in chapter titles mean exactly the same thing as articles anywhere else. "A" means a non-specific instance of a thing, while "the" means a specific instance.
I haven't read the Harry Potter books, but if one is title "The Chamber of Secrets", I would take that to mean that there is one particular chamber that this book is talking about. If there were many such chambers and this book was only about one of them, then the title would have been, "A Chamber of Secrets".
Bear in mind that "the" can be used when there are many instances of a thing in the world, but we are talking about one particular example that we have identified. We often see a shift from "a" to "the" in a single paragraph or even a single sentence because of this. Like, "I saw a car in the street. The car was parked by the mailbox." In the first sentence, we use "a" because it is one of many cars that exist in the world and we have not yet narrowed the range of our discussion. But once I refer to that car in the first sentence, now there is one particular car under discussion, so the second sentence uses "the".
One way that titles are different from ordinary writing is that they often leave out words. A newspaper headline might well say something like, "Car Accident on Third" rather than a complete sentence like "There was a car accident on Third Street." So "Chamber of Secrets" would be an equally likely and valid title as "The Chamber of Secrets".
Likewise, because it is abbreviated like this, a title might use "the" when the context has not been established, and we would use "a" in a complete sentence. Like you might see a title like, "The Man in the Black Hat". While presumably there are many men with black hats in the world so we wouldn't begin a conversation by referring to "the" such man. But for a title, we're leaving things out. In this case, the context of which man we're talking about. So if a title uses "the", that might be intended to indicate that there is only one instance of whatever in the world, or it might mean that when you read the book (or see the movie or whatever), which one it's talking about will become clear.