The ultimate answer to a "why" physics question is "because".
Physics is about observing and measuring nature and then finding mathematical models that fit the measurements and predict new behaviors under different conditions.
Because we have observed these four states of matter. we have formulated mathematical theories called thermodynamics and quantum mechanics that can describe the behavior of matter and predict its future behavior in addition to describing a plethora of other behaviors ( as how we can communicate on this board).
How this happens can be explained within the mathematical models.
atoms and molecules are neutral bound states of charges and mathematically there are spill over forces that create attractions and repulsions.
the states are quantized, i.e. the bindings are not arbitrary and continuous but specific energy states are stable and others are not stable
solids are when the energy states settle in lattice configurations and are at the lowest energy state.
liquids happen when thermodynamic conditions, temperature and pressure, are such that some of the bonds of the lattices are loosened, and extra degrees of freedom appear.
gasses appear when tempearture and pressure combinations loosen all the intramolecular energy level bindings and it behaves as an ideal gas
plasma happens when the temperatures and pressures are such that the electrons are ejected from their orbitals and the gas becomes ions and electrons.
6)plasma happens when the temperatures and pressures are such that the electrons are ejected from their orbitals and the gas becomes ions and electrons.
All these processes are described perfectly using quantum electrodynamics and thermodynamics as also described in the other answers.
That is the mathematical map of the nature we found ourselves in. (That's the way the cookie crumbles, That's the way the ball rolls, etc ) If there were only one phase, a different set of theories would describe them, not the ones that describe successfully our present world.