Definition of Hostile Witness
A hostile witness (also known as an adverse witness or unfavorable witness) is someone whose testimony is considered unfavorable to the party who called them to testify. A hostile witness may be asked leading questions and may be cross-examined by the party who called them to the stand after the questioning attorney asks the judge to declare the witness as hostile. After this declaration the attorney will have more leeway to question the witness and possibly produce testimony which is better for their client.
Having a witness declared as hostile is done much less frequently in real life than in television crime dramas. Prior to the trial each attorney has prepped their witness and questioned them enough to understand what their testimony is likely to cover, although occasionally there is testimony provided by a witness that is unexpected or is less supportive than originally thought.