Almost immediately after the Big Bang, five fundamental forces of nature each decoupled from the original state of the initial condition, one after the other. This happened because as the universe cooled down from the level of maximum heat, it began to cross the various different transition temperatures at which forces separate out from one another. So, as this occurred, each became their own distinct essential interaction in a primordial process of symmetry breaking.
attractive → repulsive → attractive → repulsive → attractive/repulsive
(gravity → levity → strong nuclear → weak nuclear → electromagnetism)
Each fundamental force is carried by messenger particles that are quanta of a particular kind of field. The long-range bosons started it all off when gravity came forth as the first fundamental force. Then, as the strongly symmetric structure of the universe weakened even further, levity (dark energy) was the next kind of interaction to emerge. So, the outward pressure that levitons exert caused an extremely rapid exponential inflation of the universe, in a really short period of time.
Then, the strong nuclear force broke free from the weak interaction, when gluons appeared. Following this, the weak nuclear force decoupled in yet another symmetry break, producing a new set of exchange particles. Finally, after the short-range forces had both come forth, it was time for the mid-range bosons to shine. So, photons emerged bringing forth the power of electromagnetism. Such is the simple story of the formation of the forces.