Because of audience knows something the characters don't know, whatever the characters say has a different meaning for the audience.
Examples of Dramatic Irony are:
1) In Romeo and Juliet, we know that Juliet is alive but Romeo thinks she is dead.
2) In Toy Story, the audience know that the toys move when people are not there.
In Dramatic Irony, the audience are motivated to say something to let the characters know what is truly happening.
Like in a horror movie, you know that the killer is inside the house, and when the character goes inside the house, you, the viewer, wants to warn the character of the killer's presence.