If there's one thing one this planet that Disney knows how to do better than almost anyone else, it's how to see the flaws in their own work and then improve upon them. Animated movies, in particular, go through tons of different versions, as the filmmakers make changes both big and small; Zootopia, for example, almost used shock collars to "control" predators. Frozen was no different, and the film almost had an entirely different ending. You may know that Elsa was originally planned to be the villain, but instead of sister hugs, the movie would have ended with an epic fantasy battle.
Frozen producer Peter Del Vecho opened up about the making of Frozen to Entertainment Weekly, revealing that the original script for the film was remarkably different from what ended up in theaters. Elsa was conceived as a straight up ice queen who literally froze her own heart after she was left at the altar, while Anna was just an innocent female heroine. Neither of them were royal and they weren't related. Instead of wanting to be left alone, Elsa had a bit more destruction on the mind, and was going to attack the kingdom of Arendelle with an army of snow monsters (versions of which made it into the finished film). Not quite the same as the heartfelt ending teaching the value of familial love.
That's a crazy idea for a climax, but this is still a Disney movie, after all, and both Anna and evil Elsa would have gotten happy endings. At first, Frozen was going to open with the telling of a prophecy that "a ruler with a frozen heart will bring destruction to the kingdom of Arendelle." Both Elsa and the audience believe the prophecy is referring to her. Fast forward to the ending, where Anna and Kristoff are trying to stop Elsa's attack. Prince Hans (who's still a total d-bag) purposefully triggers an avalanche to stop Elsa, not caring that he'll kill everyone else in the process. Anna realizes that Elsa is their only hope and she convinces her to use her powers to save the kingdom. As it turns out, the prophecy actually refers to Hans and Elsa's act of kindness unfreezes her heart and she can feel love again.
Cue happy ending.
This ending isn't actually all that bad, and could have been compelling with its villain reversal, so why didn't they keep it? As Peter Del Vecho explains, they just weren't feeling it. The producers didn't think there was any emotional connection to Elsa, mostly because she spends the whole movie as a villain. In the pursuit of making her more sympathetic, they eventually got to what landed in theaters, and the movie is all the better for it.
Don't forget that Frozen 2 is on the way, although it does not currently have a release date.