Reveal It Whenever It Has the Most Emotional Impact
Like many things in writing, there is no one "right" way to do everything. You could reveal the backstory of the character at the beginning of the story, the middle, or the end. The important question to keep in mind is: when will this reveal have the most impact?
The whole point of a backstory is that it's meant to help us see the character in a new light. It fleshes out their motivations and gives reason for their actions. For example, when we first meet the character, they have killed a close friend of the protagonist. Because of this, we as the audience are led to believe that they are a heartless monster.
But then it is revealed that the character only killed that person because they murdered his entire family in cold blood.
This shows us as the audience that things may not be as black and white as we initially thought. It serves as a double punch because we learn that a character we thought was the bad guy actually had a point, and a person we thought was a good person might have been a horrible monster.
Here are some things to avoid:
1-Try not to exposition dump. Worldbuilding is at its best when the audience is slowly being fed important information and context clues, even without them necessarily realizing it.
You don't want to hit the audience with every last piece of information about the character's backstory at the same time. Especially if it's deep and complex.
"I was born in the kingdom of Meltros, and my wife was killed in a horrible fire, which inspired me to kill the evil king who ordered my wife's death...Now let me monologue about how I became a wizard's apprentice, found the sword of darkness buried in a stone, and how I paid my taxes, and brushed my teeth. I have the strangest compulsion to let you in on all the most intimate details of my life, almost as if I'm being compelled by some invisible author to give my backstory."
It's better to drip-feed the audience information over time.
First, you notice how the character is always looking at a locket of someone.
Another character accidentally mentions the character's wife, and the man freezes up, saying he does not want to talk about it.
Then you notice that there is a horrible burn mark under his shirt.
The character also has a strange obsession with bringing down the Empire, and he fights with more fervor than anyone on the team.
After building it up for a while, then you finally drop the information bomb that the woman in the locket is his wife, she's dead, and he was there in the fire that killed her, and he still has the burn marks to remind him.
Take your time to foreshadow what the character's backstory is first. Then the information will be more satisfying when the full story comes out.
2-Timing is everything.
If the backstory is twelve pages long, you don't want to shove it in the middle of a high-action scene just because you really wanted to add a bunch of unnecessary information.
Let's say the characters Robin and Jay are in the middle of a life-or-death fight...and then we interrupt that fight halfway to have a flashback about an unrelated character, Raven, and her tragic backstory.
You don't want to interrupt the action just to drop more exposition about the characters, not unless you have a good reason for it, such as you are intentionally trying to leave the audience on a cliffhanger.
Don't have the characters drone on about their past struggles for too long, or you risk losing the audience's interest. If you're gonna have a scene where they sit down and tell people their backstory, really take the time to plan out the scene. Show us how the past experience has affected the character. Make it deep but concise. No matter what, do not break the story's flow.