When the first railroads were built in Britain, they simply took carts that had been made to the usual dimensions, and made them run on rails. And I've read that somewhere in Greece or Italy there are ancient roads paved with stone blocks, and the stone has wear patterns from wheels spaced the same as those carts that first ran on rails. So it seems to be the best size to make a cart. Would a different gauge be better for railroads? Maybe, but 4' 8.5" works well enough.