When the effect on a dependent variable (Y) of one factor (X), depends on the presence of another factor (Z), the outcomes are reflecting the existence of an interaction.
An interaction occurs when there is a regression with more than one explanatory variable, and the simultaneous effect of two of them on Y is not additive. Therefore it is necessary to include both variables in the model accompanied by an interaction term that should be implemented as an extra regressor.
To provide extra insight, when interactions happen between X and Z, the presence of X moderates the effect of Z and viceversa.