Edmund Spenser wrote The Faerie Queene to give England a grand poem of celebration for queen, country, and religion, and to provide a model of virtue for his readers. Let's look at each of these in more detail.
Spenser believed that England hadn't seen much in the way of great literature since Chaucer, and he decided to create a grand poem to show the beauty and majesty of his native land. As an admirer of Queen Elizabeth, Spenser put her at the center of his allegorical poem as the title character, the great Gloriana. He also proclaims England's Protestant religion by promoting it over Catholicism, which he firmly and creatively condemns throughout the poem.
Further, Spenser desired to show the people of his era what it means to practice virtue, and he does so through characters like the Red Cross Knight and Una, and through the poem's various books focusing on faith, chastity, temperance, friendship, justice, and courtesy. The knight gets himself into trouble when he strays from the path of virtue, but when he perseveres in right thoughts, words, and actions, he meets every challenge with victory. Most, if not all, of the characters in The Faerie Queene are allegorical, so they teach their own lessons in virtue (or the lack thereof), and they get exactly what they have coming to them based on their behavior. Actions, Spenser teaches, have consequences.