In a nutshell
The longest common subsequence is the longest run of letters that appears in both strings in the same order, though not necessarily next to each other. A grid compares every prefix of one string against every prefix of the other; a matching letter grows the run diagonally, and the bottom-right cell holds the final length.