Why is it called a 2x4 if it is really on 1-1/2”x3-1/2”?

The piece of wood started out 2”x4”, but the process of drying and planning made it smaller. How much it shrinks depends on whether the lumber has been left green (undried) or has been dried.