Actors are usually given a script to work with, which they have to thoroughly read and memorize so that they can nail every line at the right exact time. But sometimes, actors will go off-script, and act out or say something that they weren’t supposed to, or that at the very least wasn’t scripted beforehand.
When an actor does this and goes off-script, it is said that they are ad libbing, or using ad lib. They can also be said to be doing impromptu dialogue or actions, as it is something out of the blue that wasn’t planned.
Some people refer to going off-script as improvisation. But here’s the thing. Improvisation is the practice of performing or acting out something when there is no script, to begin with, so everything is impromptu and improvised. When actors go off the script, they simply ignore or forget what was scripted, and add in their own impromptu dialogue or action, which is ad libbing.