Growing up with this system, and the ones that came after, it’s perfectly logical to me…
The logic is, “A” comes first, so it’s the logical choice to label your “primary action” button. Now, your primary action button is of course the one you press most. Therefore, why not make it the easier of the two buttons to get to, by putting it closer to the edge where you can just mash it with your thumb without worrying about the B button getting in the way?
To be fair, your way of thinking is valid as well, and much more common. The Sega Master system, roughly contemporary to the NES but nowhere near as popular as the NES or its successor the Sega Genesis, has its buttons numbered 1 and 2 from left to right. The Genesis has A, B, and C buttons, again arranged left to right. The PlayStation, of course, never bothered with letters; the x, square, circle and triangle have become ubiquitous. XBox uses letters, with A still in the “home base” position but with B to the right of it at “first base”, but more importantly each of the thumb buttons is color-coded so that the in-game icons for each button are very distinct either by shape, color, or both. From what I’ve seen the colors of each button have been far more important than the letters.
The SNES kept the “A outside” paradigm, but the “ballparked” arrangement of buttons made the B button easier to get to than the A button, and on that system the B button became the “primary action” button for most games, with the Y button (above and to the left) becoming the “secondary action” button, allowing “pad-knuckle rocking” (press B with the first knuckle of the thumb and Y with the pad/tip of the thumb). The A and X buttons were then generally relegated to less common tasks.
The A button returned to prominence on the N64 controller, with the ballpark arrangement tweaked to put A in the coveted “home plate” spot, and the B button above and to the left, allowing the easy “thumb-knuckle rocking” that players had gotten used to with B and Y on the SNES. The GCN kept the focus on the A button, this time by making it the biggest button on the controller (possibly the biggest single button on any stock console controller) but B was still kept on the left. Of course the Wii’s controller was a complete paradigm shift to incorporate the pointer/motion-sensing aspect, and the A and B buttons are on completely opposite sides of the thing.
It’s notable that when the Wii-mote is held sideways and used “platform” or “racing”-style (not the most comfortable arrangement by any means, but passable especially when using a shell like the Wii Wheel or BOSS), the buttons pressed by the right thumb are the “1” and “2” buttons, and are arranged left to right. So it took 20 years, but Nintendo did eventually get with the program in this small way. The plug-in “Classic Controller”, however, reverts to the SNES layout with B at “home plate” and A at “first base” (even though many of the games it’s used to play, like NES Virtual Console games, use A as the default primary action button).