The Force is a metaphysical energy field that spans the entire galaxy, for which life in the Star Wars galaxy cannot exist without, manifested in physical reality as midi-chlorians. And it is sentient in its own, unique way. As for why the Force exists as it is, no one knows.
A lot of the things about the Force concerns the Light side and Dark side of the force. Light side of the Force are usually associated with Force-sensitives who uses the feelings of honesty, compassion, mercy, self-sacrifice, and other positive emotions as a source of power, whereas the Dark side Force users draw power from raw emotions like anger, hatred, and passion. As for why such two states of the Force exists, no one knows.
The conflict between the Light side and the Dark side Force users forms the central conflict of the entire series, endlessly repeating in a cycle of war and destruction over tens of thousands of years of galactic history. As for what the Force gained from allowing this to happen, no one knows.
I have a theory concerning the reason why such a situation exist: The Force is a galaxy-spanning emotional parasite.
The Force, I think, is simply an Eldritch Abomination that feeds all forms of emotions in general, needing both "Light Side" and "Dark Side" and all the other kinds of emotions as subsidence much like how a human body needs different kinds of nutrients. The overall conflict between Light Side and Dark Side of the Force and "The Balance" of the Force is basically a massive negative feedback system that allows the creature to control the amount of emotional 'nutrients' it absorbs, for the sake of maintaining Homeostasis.
The powers and abilities of the Force and existence of Force-sensitives are merely the means to do so.
For example. The reason why the Dark Side of the Force is so addictive is because when it needs more "Dark Side" emotions to feed on from the Galaxy, it would be easy to corrupt Force-Sensitives, especially powerful ones like Palpatine, to create Sith lords who would then unleash Hell in the galaxy via the Force magnifying the worst traits in them with the power. This would inhibit the amount of "Light Side" emotions produced (e.g. The many destruction of the Jedi Orders throughout Star Wars history) and lead to ages of conflict, oppression and chaos (e.g. Imperial Era and The Galactic Civil War), which would result from a massive release of raw, negative emotions from the trillions of sentient beings in the Galaxy, on which the Force would feed on, via the Midi-chlorians in the sentient beings' bodies.
Light side of the Force? Same thing. When it has enough of Dark Side emotions and need Light Side ones, it might subtlety influence a lone Jedi or many Jedi to rise up to oppose the evil Sith lords (e.g. Galen Marek, General Kota, Luke Skywalker), which would be inevitable anyway. The Force might even subtlety influence the Sith Lords so that it amplifies their flaws (e.g. Palpatine's overconfidence and ego, preference to creating fear which backfires on him), making them easier to take down.
If successful, eras of peace, freedom and order would be restore in the galaxy (E.g. New Republic Era), which in turn inhibits Dark Side emotions (aka forcing Sith into retreat) and results release of positive emotions from the trillions of sentient beings in the Galaxy, on which the Force would feed on. The Balance is once again restored.
If my hypothesis is true, then this means ultimately, all the inhabitants of the Star Wars galaxy, good or bad, noble or sinister, exists solely as cattle for a cosmic horror, a sinister god-like creature of unimaginable power with goals which sentient beings of Star Wars could not comprehend, indifferent to the petty morality of the insignificant microbes of the physical universe, and actively exploits it by playing on both sides of good and evil, giving them force powers to use for purpose of devouring the emotions released from the aftermath of their usage, for good or ill.
It's just a scary hypothesis, though. Like the The insidious Force theory by Darth Traya during the Old Sith Wars, but much, much darker. The true nature of the Force might never be known.
Life sucks and is probably meaningless, but that doesn't mean there's no reason to be good.
--- The Anti-Nihilist view in short.