Agency is one of the most important principles of the gospel and also one of the most misunderstood. So let’s start with a definition. Agency is the ability to make choices. But Elder Packer explained that all references to agency in the scriptures refer to a specific kind of agency–moral agency. Moral agency is the ability to make choices between good and evil. Frequently in the Church we confuse the principle of moral agency with the principle of freedom. Freedom is the ability to act on the choices we have made. For example, if I am choosing between drinking apple juice and orange juice, I use my non-moral agency but if I am deciding between coffee and milk I am using my moral agency because there is a commandment involved. If I choose grapefruit juice, but there is none available, my freedom is involved. As much as I might want it, I can't have it because there isn't any.
There are several reasons this designation is important. One of the most important is that there is ALWAYS a spiritual consequence when we use our moral agency. There are no spiritual consequences to using our non-moral agency or freedom. The negative consequences of bad moral choices are obvious, but I said ALWAYS a consequence. In King Benjamin’s great speech he tells us that the Lord requires "that ye should do as he hath commanded you; for which if ye do, he doth immediately bless you" (Mosiah 2:24). The immediate blessing that comes from obeying God is increased faith. Faith is a gift of God predicated upon the law of obedience! (See D&C 130:20-21). As we grow in faith, we then are blessed with more spiritual gifts and increased gospel knowledge.
Another reason this designation is important to understand is that agency cannot be taken away from us. (I know you’ve heard that it can, but the person is using the word agency to mean freedom.) Lucifer fought a battle in the pre-mortal world to take away our agency and failed. He is not going to waste time doing that again. Instead he works on taking away our freedom. If he can limit our choices or through peer pressure, addiction, or other means entice us to negative choices, he has us in his grasp. Technically, we still have our agency. We can choose to repent and return to the light. However, as we loose freedom, it becomes more and more difficult to exercise our agency to follow the Lord.
Agency, then, is a mental process. It is the means God has given us to choose our way back to Him and returning to Him is done one little choice at a time.
PS - There is a wonderful autobiography in which Victor Frankl explains how he came to understand these principles while in a Nazi concentration camp. It is short and well worth the read. The title is Man's Search For Meaning.