There are cities named Kansas City in both states.
Kansas was originally the name of the river there, before there was a city or a state. The city in Missouri also formed long before there was a state named Kansas. At the time, the city was just called Kansas. Later, the territory of Kansas (now the state) was formed and the city was renamed from Kansas to Kansas City to prevent confusion. The territory of Kansas didn't become a state until much later (after a long delay due to a violent conflict over whether it should have slavery, which in retrospect was really the beginning of the Civil War), and since the city had already been called Kansas or Kansas City for a long time, it wasn't renamed again.
There are many cities named Washington that aren't in Washington State. There is also a Virginia City in Nevada.