The strong odor comes from sulfur compounds, indoles, skatoles, and other volatile chemicals. Testosterone increases concentration, and tomcats mark territory with strong-smelling urine.
Evolutionarily, the smell attracts females and warns other males. Castration lowers testosterone and significantly reduces odor.