In the theater, an understudy is a backup or alternate for another actor in the play. If the lead in the school play comes down with the flu, her understudy will have a chance to perform the starring role.
The show must go on (as they say in show business)—which is why an understudy has an important job. He or she has to learn every line and be ready to fill at the last minute. You can also use this word as a verb, so you might say, "I'm going to understudy the role of Aaron Burr in Hamilton!" An understudy often plays a smaller role in the play as well, filling in for main roles as needed.