Can someone explain `If the character at the s1[i] does not match s2[j], we don’t have any common substring.`?

if s1[I] !=s2[j]
dp[i][j] = Math.max( dp[i-1][j] , dp[i][j-1]);
dp[i][j] = dp[i-1][j-1] +2
dp solution should translate to above logic from bruteForce right?

I don’t understand how the below logic is correct
if s1[I] !=s2[j]
dp[i][j] =0;

This logic is correct it means that if the s1[i] and s2[j] doesn’t match then it means that in the 2d array on that location the value will be zero. if it matches then we will count it.