Here are the basic structures of your teeth. When you get a cavity it starts with the enamel and works it's way into the dentin. The dentin is much softer than the enamel and once it get's there, the decay develops much more quickly. If it get's to the pulp cavity, Ouch! The nerve becomes exposed and infection sets in. That can mean swelling. As gross as it sounds, I have to tell you, that the swelling is caused by puss filling up the space all around the tooth. This is very dangerous to your health and can be very painful. Sometimes the infection will actually destroy the bone enough to find a way out and will start draining. The swelling and pain may stop, but now the infection is draining into your body. Not a healthy situation. Serious health issues can develop from mouth infections. People have actually died from infections starting in the mouth.
Once the pulp chamber is exposed you will need root canal therapy. The pulp has to be cleaned out and the nerve removed. The pulp chamber is then filled in with a special material. Once the nerve and blood supply has been removed the tooth will become brittle and must be crowned in order not to break.