The energy stored in the container is a kind of potential energy. When an object is moved to another state or position by changing its normal state or position, potential energy is stored in it. It is only natural that they would want to stay away from each other because of the repulsion between the charges. The potential energy is stored when a number of homogeneous charges change from this normal state to the storage of the container.