Short Answer
The name of a lawsuit is the name of all of the Plaintiffs in the lawsuit v. the name of all of the Defendants in the lawsuit. This name appears in the "caption" of every document filed in court in the lawsuit (except evidentiary exhibits). The names of non-parties to a lawsuit does not appear in the name of the lawsuit or in the caption.
Often, the body text of a legal complaint or a motion in a lawsuit, however, would mention the relevant non-party as part of the factual allegations in the case. A proper name reference isn't always required (not all evidence and facts in the case have to appear in the complaint). But the people involved have to be identified unambiguously or the case risks being dismissed. Sometimes, a "John Doe" or pseudonym can be used instead if the person can be unambiguously described.
In practice, it would be quite unusual not to identify a key third party by name, especially under recently adopted rules that require more factual specificity in complaints in the U.S. federal courts and many state courts.
Third-parties from whom relief is not sought in a lawsuit do not have to be (and usually, should not be) named as defendants in a lawsuit.
Long Answer
The issue of who had to be a party to a lawsuit is called joinder. A necessary party must be joined as a party to the case as a matter of mandatory joinder. A party who can be a party, but doesn't have to be present may be joined as a party to a case in what is called permissive joinder.
Mostly, joinder issues involve who should and should not be defendants in a case. But the plaintiff must be a real party in interest (a term of art for someone who is allowed to bring a lawsuit for a wrong, sometimes even someone who wasn't directly harmed by the wrong), and sometimes (but not always) all real parties in interest (or more than one of them, at any rate) must be plaintiffs in order to bring a lawsuit.
The main rules governing the issue of joinder are set forth below.
Generally, Only People From Whom Relief Is Sought Are Defendants
In a lawsuit, generally, the only defendants are the persons from whom relief is sought. Relief could be money damage. It could be an order to turn over property or specifically perform a contract. Or, a lawsuit could be seeking an injunction against a defendant ordering the defendant to do something, or to refrain from doing something.
But, when the relief sought is a declaration of rights (either in property, or otherwise), that affects multiple people, then a different rule applies, because in those cases, part of the relief sought is to bind everyone who is affected by the court's ruling.
There Is An Exception For Defendants Sued In The Alternative
In rare cases, one might name several defendants who are sued in the alternative, because the statute of limitations is approaching and the plaintiff knows that one of the defendants caused the harm, but not which of the defendants did so (e.g. if someone crop dusted your organic farm, ruining it as an organic produce source, but you don't know which of three crop dusting firms in your area did so).
Mere Witnesses Are Not Named As Defendants
One does not have to (and should not) name a party simply because they are witnesses or have evidence. Information can be obtained from third-parties via a subpoena.
In the OP, for example, Person B, who was merely a person discussed in a defamatory statement about Person A made by Person C, doesn't need to be named as a party. Person B is just a witness and the "subject matter" of the lawsuit.
In the same vein, suppose that someone is suing to have 100 shares of AMC Corp. stock that they bought from another stockholder delivered to them. AMC Corp. doesn't have to be made a party to the lawsuit, even though AMC Corp. is the subject matter of the lawsuit.
People Merely In Possession Of A Defendant's Assets Are Not Named As Defendants
Likewise, one does not (and cannot) name a party simply because they control assets from which a judgment can be collected if the plaintiff prevails. Assets belonging to a defendant controlled by a third-party are obtained after a judgment is entered in the case via a writ of garnishment.
Not Every Legally Liable Defendant Has To Be Sued
Often, it isn't even necessary for a plaintiff to name every party that could have liability in the case as a defendant.
A Contract Case Example With A Guarantor
For example, say that son signs a lease with landlord that father personally guarantees and that when the son moves out, not all of the rent has been paid as agreed and there was property damage to the apartment. The landlord could sue only the father, even though the son has legal liability as well, because the son might be harder to serve with process and might be judgment proof.
A Personal Injury Case Example With A Non-Party At Fault
Similarly, suppose that multiple parties are at fault in a car accident, maybe one driver drove through a red light, which caused the car that was hit to stop suddenly, causing the car that was hit to be rear ended by another car. The driver who drove through the red light and the driver who rear ended the car could both be at fault. But, if the car that drove though the red light had no insurance, the plaintiff might only sue the driver who rear ended them. The driver who rear ended the plaintiff could then designate the driver who drove through the red light as a "non-party at fault" and even if that driver is never named as a defendant, the jury still has to allocate liability for the accident between the driver who went through the red light and the driver who rear ended the plaintiff (with the liability allocated to the non-party at fault simply being non-recoverable by the plaintiff).
Plaintiffs Can Only Sue People Who Owe Them Duties, But Someone Who Owes A Duty To A Defendant In The Same Incident Can Be Sued As Third-Party Defendants By A Defendant
Similarly, if there is someone who might have liability arising out of an incident, the plaintiff shouldn't and can't sue that person as a defendant if that person doesn't owe any duties directly to the plaintiff.
For example, suppose that a property owner hires a general contractor to build an office building, and the building is partially completed, but the final stage of installing the air conditioning units isn't completed. The property owner can only sue the general contractor for the cost of hiring someone else to finish the job. But, the general contract can sue the subcontractor whom the general contractor hired to do the air conditioning work but never showed up after being partially paid in advance, in a third-party complaint to indemnify the general contractor for some or all of its liability, in the same lawsuit (so that there are consistent judgments as to all affected parties).
All Affected Parties Must Be Defendants In Many In Rem Actions And Many Declaratory Judgment Action
The exception to the general rule is in cases seeking to adjudicate rights in some particular property (or in a bundle of property, such as a probate estate or bankruptcy estate), in which everyone who might have an interest in the property must be named as a defendant so that their interests in the property can be protected in the litigation.
Another exception to the general rule is an action for a declaratory judgment interpreting, for example, a contract, in which every party to the contract must be named because an interpretation of the contract could impact everyone who is a party to it.