Before we can discuss the application of TEEs for blockchain related programs, we first have to establish what Trusted Execution Environments (TEEs) are.
At a high level, TEEs can be described as an isolated processing environment found on the CPU, a sort of separate secure area where whatever code and data enters remains confidential, where processes outside of a TEE cannot read or tamper with the data within it. These private regions of memory are known as enclaves.
By running code in this isolated, tamper-resistant processing environment, it "guarantees the authenticity of the executed code", where remote attestation can be provided to prove its trustworthiness to a third-party and untrusted code should not be able to interfere with the execution of a program within the TEE.
Ref: "Trusted Execution Environment: What It is, and What It is Not", Sabt et al.