Let x and y be the dimensions of the rectangle. If the perimeter is 40, we have

We can expression one variable in terms of the others as

Since the area is the product of the dimensions, we have

This is a parabola facing down, so it's vertex is the maximum:

So, the maximum is

And since we know that
, we have
as well.
This is actually a well known theorem: out of all the rectangles with given perimeter, the one with the greatest area is the square.