The two lines labelled AB are actually strips of two different metals, attached to each other (usally be welding them together, I think)
When the temperature changes, the metal strips curve or bend to the right and touch the thing in the upper right of the figure.