Tea makers dry and crush the leaves to bring out their oils, then they might expose them to air for a while, depending on the kind of tea they want to make. This is called “fermentation” -- it’s a chemical reaction that affects the flavor of the leaves and turns them brown.
The longer they’re exposed, the more caffeine they have. Green tea uses leaves that haven’t been fermented at all, which is why it has almost no caffeine. Oolong uses leaves that have been fermented for a time, while black tea leaves are fermented the longest.