Why did God create the universe, heaven and hell?
To answer this question we must go back to the nature of God- God is self-existent. What that means is that God was not waiting around in eternity past being lonely and looking for something to do. So why did He go to the trouble? Because God created the universe first and foremost to bring glory to Himself, and second to have fellowship with His creation. Thus, everything was made because of God's design in making His name BIG. That means that every person, planet, star, galaxy, ocean, tree, and blade of grass was designed to scream out that our God is an awesome God! Heaven, then, was designed as a place where God is eternally glorified by His creation. As well, heaven was created as the place where God can eternally enjoy His loving relationship with His creatures (us).
Unfortunately, before people were created, one of His angels decided that he had a better plan for the universe. This angel was called Lucifer (Satan), and his pride caused him to ditch God's perfect plan. Satan decided that making his name big was more important than praising God. Satan persuaded a third of all the angels to follow his plan, and as a result, they were kicked out of heaven and out of their jobs as God's servants. At that moment, evil and sin came into God's perfect universe because they "missed the mark," and God sent them to a place where these rebellious beings could exist apart from fellowship with Him. This place is called hell. Matthew 25:41 tells us this place was originally created for Satan and his angels (now called demons), but it is also reserved for people who willingly choose to follow the same plan as Satan.
People on this earth who reject God's offer of eternal life through Jesus Christ make a choice to spend eternity in hell. For their entire lives they tell God - "not Your will, but mine be done" and finally, God responds - "very well, your will be done - spend eternity apart from me" (2 Thesselonians 1:8-9). This is actually an act of mercy on God's part, because it is a far worse fate for people who do not have a relationship with God to be in His constant and Holy presence, than to be in hell itself.