Generally, a statement made to another person outside of court, is inadmissible as hearsay. The idea is that what someone told someone else at some other time is not subject to cross-examination, and is therefore unreliable. There are, however, many exceptions to the hearsay rule.
One exception is called a "party admission" or an "admission by a party-opponent." When a party to a court proceeding, a criminal defendant in this case, makes a statement to someone outside of court, those statements are allowed to be used against him in court. This is because the person who made the statement - the defendant here - can testify to explain or deny the statement.
It is important to note that only the prosecution can introduce a defendant's prior statements under this exception. A defendant may not introduce his own out-of-court statements. This is to prevent the defendant from presenting his story to the jury without undergoing cross-examination.
To ensure the jury has a clear picture of what was said, however, the defendant may instroduce part of the statement if the prosecution presented only part of the statement. This is called the rule of completeness.
Miranda and the Fifth Amendment right not to incriminate oneself may play a role as well where the statements sought to be introduced are a defendant's statements to the police. But that is a different topic for another day. See my prior related post about why someone suspected of a crime should almost never talk to the police.