A 14 period rsi and a 2 period RSI are different tools despite sharing a name and a formula. The same is true of every moving average, channel and oscillator: the window dominates the output.
Common defaults such as 14, 20, 50 and 200 are conventions inherited from the eras when they were published, not optimal values. Their main virtue today is that many people use them, which occasionally matters for the self-fulfilling-prophecy effect.
Tuning the lookback on historical data is one of the easiest routes to overfitting. A robust setting should show a broad plateau of acceptable results across neighbouring values; if performance collapses when you change 14 to 15, you have found noise.
Related: overfitting, simple-moving-average, rsi, indicator-lag, self-fulfilling-prophecy