To bring glory to God, and enjoy Him forever.
One of man's enduring questions, is that of man's purpose. Men have spent a lifetime in search of meaning and have never found rest until they have discovered that for which they were created. Augustine stated that his soul was restless until it rested in God. This is true. Men find themselves unfulfilled until they find the lasting meaning of life with God. C.S. Lewis stated that men are uncomfortable in this world because they were made for another. Man's primary purpose is to bring glory to God. When God formed Adam from the dust of the Earth, he did so that man would bring glory to himself. We seek other things as purpose and they are always lacking. Nothing fills that soul need, but to bring glory to our creator. Creature is made to bring glory to his creator and will never find fulfillment without living that out.
God is most glorified when we are most satisfied in him. These are the words of John Piper. He would also suggest that we change the conjunction in the above question to by. That the primary purpose of man is to glorify God by enjoying him forever. I would tend to agree with him. God is glorified when we enjoy his good gifts. By enjoying God we bring glory to God. Only through God can we gain the perfect pleasure in His good gifts. When enjoyed apart from God, these pleasures ring hollow and empty. Enjoyment is not true enjoyment apart from God. God intends for us to enjoy him and the gifts he has given us. He is not a celestial kill joy. He has given us many great gifts, and the boundaries in which to enjoy him and his gift. Pleasure is a sin when it is outside and apart from God. C.S. Lewis through Screwtape, in The Screwtape Letters, describes God as a hedonist at heart. This can be a shocking statement to hear, but the Bible even teaches us that at God's side are pleasures forevermore. It is only when we twist or distort the gifts of God that these pleasures become sinful. So we are meant to enjoy God, and his good and gracious gifts.
Man was created to glorify God. Man will be hard pressed to find fulfillment elsewhere. God has given us gifts that in their enjoyment, God may be glorified. These are the reasons we were created, and man can never find true and lasting fulfillment outside of them.