In solids, the atoms are closely bound to each other. The only movement possible for the atoms in this state of matter is vibration. Solids have a fixed shape. Therefore when they are put in a container, the solids remain in their initial shape.
In liquids, the atoms are loosely bound compared to atoms in solid. And the atoms are free to vibrate and to slide past each other. The liquids have fixed volume but have no fixed shape. Therefore, when they are poured into a container, their volume will be the same, but the liquid will take the shape of the container.
In gas, the atoms are very loosely bound. and the atoms are very free to vibrate and move through space. Gases do not have either fixed volume or a fixed shape. Therefore, when they are poured into a container they take the volume and the shape of the container.