All That and More....
Mark is correct that 40 inches was the accustomed size for coal and wood-fired ranges, so there was that.
But there were other good reasons to continue the size, and they had to do with early to mid-20th Century housing.
Tract housing of that era tended to be extremely basic by today's standards - you were lucky if you got eight feet of base cabinets. You didn't get even that much on the walls, because American women demand that the sink is in front of a window, which cuts into the wall cabinet space available. That meant any extra storage options were not only welcome, but actually essential - the storage drawers in a 40-inch range were badly needed. Many 40-inch ranges had three storage drawers - two below and one to the left of a single oven. Some deluxe models had two ovens and only one or two drawers, of course.
The cooktop light on a 40-inch range was also very handy, because tract houses tended to have one overhead light fixture in the kitchen, period. A light over the sink was a "deluxe" touch; there was otherwise no task lighting at all, usually.
And outlets were in short supply. A 40-inch electric range had at least one, and if it was an automatic-oven model, it also had a timed outlet. Those outlets were very helpful in a kitchen that had all of one or two wall outlets of its own.
Last came the extra cooktop space, which was useful not only for hot pots and pans coming off the burners, but could be used for small-appliance uses, such as a mixer, which could be plugged into the range's outlet.
40-inch ranges took tract house kitchens from incompetent to pretty bearable. Only later, when standards changed and new houses included more features, was it feasible to use other sizes.