Like so many things in golf, the standardized size of the hole comes to us courtesy of the Royal and Ancient Golf Club of St. Andrews, with an assist from the links at Musselburgh.
In new rules issued in 1891, the R&A determined that the hole size should be standard on golf courses everywhere. So the R&A discussed just what exactly that size should be.
The size they decided on was 4.25 inches in diameter. The reason is that the folks at Musselburgh (now a 9-hole municipal course on the Levenhall Links near Edinburgh, Scotland) had invented, in 1829, the first known hole-cutter. That ancient hole-cutter is still in existence and is on display in the clubhouse at Royal Musselburgh, an 18-hole course in Prestonpans, Scotland. (That's where the Royal Musselburgh Golf Club that used to play at the 9-holer outside Edinburgh is now based.)
That first hole-cutter utilized a cutting tool that was, you guessed it, 4.25 inches in diameter. The folks running the R&A apparently liked that size and so adopted it in their rules for 1891. And as was usually the case, the rest of the golf world followed in the footsteps of the R&A.
The exact reasons for why that first tool cut holes at the now-standard diameter are lost to history. But it was almost certainly a completely arbitrary thing, a notion supported by the story that the tool was built from some excess pipe that was laying about the Musselburgh links.