Each thread instance has a Boolean field, namely Terminated, that can be set through a call of the public Terminate method. You may think to call Terminate, which will have some immediate effect, like stopping the thread or brutally killing it, but this is not the case. Calling Terminate will simply set the Terminated field to True and call the TerminatedSet protected procedure as a consequence.
Beware, the Terminate method will execute in the context of the caller thread (that is, the main/UI thread) and so will happen for the consequent TThread.TerminatedSet method execution.
It is the thread code's responsibility to periodically check whether somebody (from outside) asked for premature termination of the thread. This might be done between steps of a multi-step operation, for example, or if the thread has a control loop, at the end of each iteration of the loop. A simple way...