I guess for the same reason we have a North and South Carolina.
Honestly, I don't know.
Just guessing it might have something to do with the size of land parcels when those areas became states.
The original 13 colonies that became states were rather irregular in shape.
Obviously having to follow the coastline on the East, and their borders formed to the West by the Appalachian Mountains. I believe the boundaries of these 13 original colonies were formed by population, natural geographic boudaries, etc. I'm no expert.
As the country spread West, and huge areas where added en masse, we came to what I've heard referred to as the "square states" in the middle of the country, of which South and North Dakato were ones.
Eventually, boundaries were formed by the Pacific Ocean.
I was born in New Jersey, every easy to identify as a stand alone place as a child, as is Texas, where I live now. I guess school children in Colorado and Wyoming have to have a pretty good eye to identify their state, when it's shown alone.