Why is the order of keys/notes on a piano C,C#,D,D#,E,F and so on as opposed to in order of consonance like C,G,E,B and so on? Thank you!
Each piano key is one semi tone up(right) or down(left) in pitch from its adjacent keys.
Your example might work if you only ever wanted to play in the key of C major but could you imagine trying to learn to build triads on a keyboard that is laid out in such a way as you suggest? Currently it is perfectly suited for playing in any key very easily.
As other answers have pointed out, there are advantages to the player in having notes in pitch order, rather than arranged by consonance; it probably makes things easier for instrument builders too!
However, the idea of placing consonant notes together isn't crazy at all. In fact there are other instrument layouts that do something like this. One example is the Stradella system, used on accordions, which uses columns of buttons arranged in a circle of fifths. Many 2D isomorphic keyboard layouts are arranged so that consonant notes are adjacent in some directions. Modern electronic instruments can often be configured so that the keys only play the notes of a certain scale.
...and of course there are other instruments, such as the guitar, that have completely different layouts; one justification for the standard guitar tuning is that it makes major thirds, fourths, and fifths very easy to reach.
So the idea of placing consonant notes together is fine; it's just that the piano chooses a different set of advantages that you get from doing it a different way!
One reason is for ease of play, as mentioned by the other answers.
But on a mechanical keyboard instrument, the keys of various pitch correspond to strings of various lengths, and it is way easier to build the the steel frame if the strings are sorted by length like organ pipes, rather than alternating all over the place.
Consonant in which tuning or scale? Consonant in which respect and harmonic function? That way lies madness or the bandoneon, an instrument having a different layout for left hand (accompaniment) and right hand (melody, at some point of time for a fixed scale but with chromatic notes grown like cancer all around the regular part) and for pushing (original layout for the major scale somewhere in the middle) and pulling (original layout for the dominant of the major scale).
It is reputed to be one of the hardest instruments to master, and it still has quite fewer actual notes than a piano in spite of having about double the sound "locations" (a location being a physical button but counted twice for pushing and pulling since the notes are different). And yet its evolution (during which it accreted more and more buttons) started on the premise of creating an instrument simpler to play than a fully chromatic one.
It certainly would work - but only in the key suggested - or any other key using that key's harmonic set.
Moving to any other key to play in would be a nightmare. It's bad enough for beginners now, with very few patterns being capable of simple movement to other keys,(without changing black/white key patterns) but with a key specific setting as you suggest, it's almost like going back in time to when harpsichords only sounded good in one key - but that was their tuning, so a different reason.
So, basically, no. I guess just about every possible idea has been used with reference to where notes are found on pianos (and other instruments), and what we end up with is the best available - even though often that's a compromise.