Denim is made by taking cotton yarn and threading it together with a twill weave. The yarn that comes from a cotton plant has to be dyed to resemble the desired colour of pants. Any cotton fibres that enter a factory must be quality inspected for length and especially strength.
The process can vary slightly for different types of denim products. Stretch denim for example weaves in spandex or similar elastic material to give it stretch and flexibility.