I assumed that the factual allegation in a complaint were always assumed true so an affidavit by the Plaintiff verifying the accuracy of the factual allegation would appear unnecessary, or? Why is this done?
There are several reasons to verify a complaint (i.e. to swear that its factual allegation are true).
1. This is required for certain kinds of claims in certain jurisdictions as a matter of statute or court rule, which vary widely.
For example, in Colorado, a "replevin claim" (i.e. a claim for expedited recovery of possession of specific tangible personal property) must be verified, and the object will be repossessed by force under court order if a timely response is not filed, often in a matter of a week or two, when the lack of a response could be due to reasons other than a lack of a good defense to the seizure.
Generally speaking, this is required when the relief requested is extraordinary relative to an ordinary lawsuit to collect an unpaid bill or recover damages from an injury in an accident, but requirements vary considerably from one jurisdiction to another.
Historically, at least, there have been jurisdictions in which all complaints must be verified, and there are other jurisdictions where it is almost never required.
2. The lawyer wants to insulate himself from liability.
A lawyer is required to exercise due diligence to confirm that the facts in documents filed with a court are true. Normally, a lawyer is entitled to simply rely on the fact that this lawyer's clients are telling the truth. But, if the client is sketchy, it is hard to independently confirm the facts, or the facts alleged seem extraordinary, the lawyer can be mostly insulated from liability for sanction for filing a complaint that lacks a factual basis by having a client swear to the fact under penalty of perjury.
3. A motion for summary judgment is likely.
In most U.S. jurisdictions, if a party defending a claim provides a factually detailed affidavit in support of a motion to dismiss a case because the facts alleged in the complaint are not true, the claim against that party will be dismissed unless the party bringing the claim files a response to the motion for summary judgment supported by a factually detailed affidavit disputing the facts alleged in the defending party's affidavit on material issues that creates a "disputed issue of fact" that must be resolved in an evidentiary hearing or trial by a judge or jury.
If the initial complaint contains factually detailed assertions in support of its allegations that are verified, i.e. sworn it as if by an affidavit, then that route to ending the case prematurely with a motion for summary judgment is largely thwarted. This can be a particularly valuable tactic for a plaintiff is the plaintiff may not be someone whom it is easy for the plaintiff's lawyer to contact on short notice.
Generally, things in a complaint will be questioned or you would not be going to court. There are different circumstances where an affidavit is used so I can't list every instance here, but most of the time when a complaint is filed, at least part of it is not already on the record and would therefore be like testimony being entered, where you are sworn before testifying.
My state, Illinois, even has laws regarding it. In Illinois when they cite that law or attach a separate affidavit, they are acknowledging they complied with that law. http://www.ilga.gov/legislation/ilcs/documents/073500050K1-109.htm