Why does Gretchen get salvation at the end of Faust Part I?
I don't understand why Gretchen gets salvation at the end of the story? Please explain!
Is it because her downfall had to do with the devil messing with her life so all is forgiven?
This is actually a complex and difficult question. If we look for the answer from a textual perspective, we have to note that when Goethe finished the text of "Dungeon" in 1774, the Voice (From Above) was not in the scene. The voice and the message of salvation were added at a later date during one of Goethe's several additions to Faust I & II. So in the original Faust, the Urfaust, Gretchen did not receive salvation, or at least, she would not have received salvation then. We don't know what would have followed if Goethe had not added her salvation there, because later additions rejected the style of emotional frenzy with which he started and adopted Classical style, thus creating a very different work from the one begun.
If we look for the answer from characterization and plot perspectives, we might have an easier time sorting Goethe's reasoning out. Looking at plot, the far-reaching plot included the ultimate salvation of Faust in Part II. Gretchen's salvation is a plot device whereby Faust's own salvation is achieved. (1) Faust is only tormented by Mephistopheles because God allows it in the Prologue as a wager between Himself and Mephisto. God is certain that Faust is a good man who will in the end serve Him. God turns out to be right as is seen in the end of Part II (Midnight, Outer Court). (2) Gretchen's salvation foreshadows what is to come for Faust by way of intervention on his behalf in Part II when Gretchen prays for him in Heaven and Choirs of Angels lift him up.
Looking at it from characterization, (1) if God sees Faust as a good man though presently confused, "Though he’s still confused at how to serve me," then God must see Gretchen as good. (2) Gretchen sincerely rejects Mephisto's presence at her dungeon prison and commends herself to God, both of which are significant for her salvation:
What rises in the doorway, here?
Him! Him! Send him away!
Why is he here in this holy place?
He wants me!
God of Judgement! To you, myself I give!
(3) As you say, she has been the manipulated plaything of a demon from hell and, though she has always disliked and been suspicious of him, she has no more power to withstand Mephistopheles, or his schemes for Faust to follow through on, than she might have to resist a scorpion in the night.
You can see he’s not at all in sympathy:
It’s written on his forehead even,
That there’s no spirit of love within.
Yet I’m stifled in his presence.
Therefore she is saved because she sincerely believes in God and salvation through Christ; she sincerely recognizes and rejects the powers of Lucifer in Mephisto; she sincerely submits herself to God's care, for good or for bad; she was clearly overpowered by and wickedly manipulated by the schemes and influences of the demon Mephistopheles. In addition, Goethe's plot development for Faust pivots around Gretchen's importance and salvation.