It all starts with the turbine, which is driven (turned) by exhaust gas exiting your engine. As exhaust exits through the exhaust manifold, it passes over the turbine and spins it. The more exhaust that passes through, the faster the turbine spins. That's pretty much how it works, at least for now.
A shaft connects the turbine and the compressor, so when the turbine starts spinning as the engine is started, the compressor starts spinning too.
The compressor is in charge of drawing in air from outside the airplane, compressing it, and then transferring it into the engine. And as you've already read, the compressor is spinning because it's connected to the turbine, through a shaft.
Now that you know the basics of a turbocharger, there are a few more pieces to cover.
Turbochargers are good at increasing the air pressure in your engine's intake manifold, known as manifold pressure. But sometimes they're a little too good. Turbochargers are capable of producing too much manifold pressure, which can damage or destroy your engine.
So how do turbochargers prevent too much air from entering your engine? With something called a wastegate.
Some wastegates are automatic, and others are manually operated by the pilot, but the theory behind them is always the same. A wastegate opens and closes to regulate the amount of exhaust gas that passes over the turbine, and prevents the turbine from spinning too fast. The faster the turbine spins, the faster the compressor spins, meaning more air that enters your engine.