The acronym FOIL is a 4-letter acronym to help you remember the 4 partial product terms of this product. They are

F (first) = x*x

O (outer) = x*1

I (inner) = 2*x

L (last) = 2*1

The sum of these is

x^2 + x + 2x + 2

Collecting terms, we have as our result

x^2 + 3x + 2

_____

This is fully equivalent to applying the distributive property.

(x+2)(x+1)

= x(x+1) + 2(x+1)

= x*x + x*1 + 2*x + 2*1

= x^2 + 3x + 2

F (first) = x*x

O (outer) = x*1

I (inner) = 2*x

L (last) = 2*1

The sum of these is

x^2 + x + 2x + 2

Collecting terms, we have as our result

x^2 + 3x + 2

_____

This is fully equivalent to applying the distributive property.

(x+2)(x+1)

= x(x+1) + 2(x+1)

= x*x + x*1 + 2*x + 2*1

= x^2 + 3x + 2