While chewing gum is pretty hearty and certain components can survive the harsh conditions of the digestive process, the idea that it can live for seven years in your stomach is definitely a hyperbole.
Before gum is swallowed, some of the sugar and flavoring is usually broken down by the enzymes in saliva. The rubber polymer base, though, is essentially unaltered, which is the whole reason that produces include it as an ingredient. When the gum is pushed down the esophagus and into the stomach, more of the sweetener and other ingredients are broken down by gastric acid.
While the gastric acid is a strong chemical, it isn't strong enough to break down the rubber polymer gum base. That does not mean that the gum stays in the stomach indefinitely, though. In fact, people consume things all the time that contain ingredients that humans can't digest, like fiber from plant products. When the body can't break down something that is ingested, the muscles of the digestive tract just continue pushing the indigestibles through the tract and out with all of the other waste.