In a Motion for Summary Judgment, one party argues that there are no "genuine issues of material fact" and that they should win purely as a matter of law. The affidavit supports this by laying out the undisputed facts under oath.
For example, in a contract dispute, the affiant might swear, "The defendant signed this contract on X date and failed to pay on Y date," attaching the contract as proof. If the other side cannot produce their own affidavit contradicting these facts, the judge may grant judgment immediately.