Up until WWII, chewing gum was made of a substance called chicle mixed with flavorings. Chicle is a latex sap that comes from the sapodilla tree (native to Central America). In other words, chicle is a form of rubber. Just like rubber bands don't dissolve when you chew them, neither does chicle. Chicle is a good bit softer than rubber bands and happens to soften more when it gets warm in your mouth. If you freeze chicle with ice, it gets very stiff -- chicle hardens and softens over a pretty narrow temperature range.
After WWII, chemists learned how to make artificial gum bases to replace chicle. These gum bases are essentially synthetic rubbers that have the same temperature profile as chicle.
Gum bases (either natural or artificial) are mixed with sugar and other flavorings to make chewing gum. When you chew it, the rubber releases these flavorings into your mouth.