The character of Mystique — the shapeshifting mutant antihero who's sided with both Magneto and Xavier over the years — has been a part of X-Men franchise lore since the beginning. In the first film trilogy, she was played by Rebecca Romijn, and was firmly on the side of Magneto. X-Men: First Class took the character in a different direction, and drafted Jennifer Lawrence to play her.
Instead of beginning as a villain, Mystique was established as a young woman who grew up with Charles Xavier as his adoptive sister. Through First Class, Days of Future Past, and Apocalypse, her loyalties have shifted, but by the end of Apocalypse she was back on Xavier's side, helping to train young recruits like Cyclops and Jean Grey. Now, with Dark Phoenix, it's her time to go. Mystique's death in the film was revealed in the trailers, as a way of making it clear that Phoenix means business.
"Well, the thought process behind that was to primarily show that this is a movie that is unlike other X-Men movies," writer/director Simon Kinberg said. "It's a movie where shocking things happen, where intense, dramatic things happen," he said. "People don't just fall off buildings and dust themselves off and walk away. There's a reality to this movie and a consequence to this movie. Even more than that, it was to show that Jean/Dark Phoenix is genuinely a threat to everyone, including the X-Men."