The keyboard as we know it was invented by a man named Sholes, for the Remington company, back in the 1880s. Remington made some of the first typewriters. (Today it's called the QWERTY keyboard, but years ago it was called the Sholes keyboard).
The typewriters had bars with all the letters on them, that would fly up against the paper. If two adjacent bars were used one after another, the one coming up would catch on the one coming back down, causing a jam. So Sholes designed the keyboard to keep letters often used next to each other from being next to each other in the type bars, to prevent jams. In a way the keyboard was designed deliberately to slow people down!
When computers came out, their keyboards were designed not after typewriters but after teleprinters (like Teletype, that's a brand name), but those keyboards were designed after typewriter keyboards.
During WWII a new layout was designed, called the Dvorak layout. You can google that name and see it. Supposedly a trained typist would take only three weeks to get used to this new layout and then he or she would be 10-20% faster. In the early days of personal computers it was thought this new layout might take over from the QWERTY keyboard, But everyone learned to type on QWERTY so that was the system that was used.
It surprises me that it's used even in the tiny thumb keyboards on cellphones! But I can see it. Once you know where all the letters are, it's hard to learn a new layout.