I’ve always wondered about this. Now I know. Via Smithsonian Mag:
Scientists tell us that the asparagus-urine link all comes down to one chemical: asparagusic acid.
Asparagusic acid, as the name implies, is (to our knowledge) only found in asparagus. When our bodies digest the vegetable, they break down this chemical into a group of related sulfur-containing compounds with long, complicated names (including dimethyl sulfide, dimethyl disulfide, dimethyl sulfoxide and dimethyl sulfone). As with many other substances that include sulfur—such as garlic, skunk spray and odorized natural gas—these sulfur-containing molecules convey a powerful, typically unpleasant scent.
All of these molecules also share another key characteristic: They’re volatile, meaning that have a low enough boiling point that they can vaporize and enter a gaseous state at room temperature, which allows them to travel from urine into the air and up your nose. Asparagusic acid, on the other hand, isn’t volatile, so asparagus itself doesn’t convey the same rotten smell. But once your body converts asparagusic acid into these volatile, sulfur-bearing compounds, the distinctive aroma can be generated quite quickly—in some cases, it’s been detected in the urine of people who ate asparagus just 15-30 minutes earlier.
Below, a lovely time-lapse video of how asparagus grows: