The reason solids, liquids and gases behave differently is due to the way their matter particles are arranged.

In solids, the particles are packed so tightly that they can't move at all.

In liquids, the particles are free to move within themselves, but, cannot escape the attractive forces of other particles.

In gases, the particles exert almost no force on each other, so, they are free to travel anywhere within the container.