Why is hearsay not allowed at trial?
In the United States, hearsay is not admissible as evidence (with many exceptions) because it would violate the defendant's constitutional right to confront his or her accusers.
When hearsay evidence is offered, defendants and their attorneys cannot confront the person who allegedly made the statement. They cannot cross-examine that person. They cannot have the jury see the person to gain an impression of his or her reliability. In other words, they are confronted with evidence against them that cannot be fully vetted or challenged to determine whether it is reliable. This goes against the 6th Amendment to the US Constitution.
You can check your state's Rules of Evidence, but here is mine, and there are exceptions to HS, see Rules 803, 804, etc. You can also scroll through the Federal Evidence Rules online.
If you vist a law library, they have Volumes called FRD, or Federal Rules Decisions, case law on the Rules of Evidence. You can look up the Hearsay Rule and case law on it and other Rules.