The electric potential energy of a system of charges is defined as the energy stored in the electric field between the charges that make up the system.
Consider a positive charge $Q$ $C$ $fixed$ at a point. The electric field lines point away from the charge. Now see what happens when I bring a unit positive charge $q$ ( where $q$ $= +1$ $C$ ) $slowly$ from $\infty$ to a point which is at a distance $r$ from $Q$. At $\infty$, $\vec{E} = 0$ and thus the two charges do not affect each other.
Since both the charges are positive, $q$ will experience an electric force of repulsion( increasing in magnitude as a result of the inverse distance squared relationship ) as you keep moving it $slowly$ towards $Q$. This force tends to prevent $q$ from approaching $Q$( look at the intermediate position ).
In order to overcome the force of repulsion and move $q$ towards $Q$ until you reach the point, you need to do work on charge $q$. In this case, you need to spend energy and since $\vec{E}$ is a conservative field( also assuming that the non-conservative forces are absent ), any amount of energy that you spend gets stored in the system of these two charges in the form of electric potential energy which is present in the electric field between these two charges. The energy goes nowhere but remains in the system of two charges. The mechanical energy as delivered by you transforms into the electric potential energy. Now, you may ask me a question 'Since $q$ is moved towards $Q$, won't there be Kinetic energy( $K.E$ ) involved?'. If you have observed, I have used the word $slowly$ while describing the motion of $q$. That was used in order to ignore any changes in $K.E$ so that all the energy spent gets converted to Electric potential energy. So, $\Delta K.E \approx 0$. So in doing work, you have lost energy and this energy gets stored in the form of electric potential energy of the system of two charges and the system is said to have gained energy. So, energy is conserved.
You can have a system of many charges. Now, to the system of two charges, I bring another positive charge $q1$. Now, you have to do work in order to overcome the force of repulsion due to $Q$ and $q$ and move it $slowly$ towards both $Q$ and $q$. You need to invest more energy in order to assemble the charges and thus the electric potential energy of the system of three charges will also be more.