For the first two thousand years after people started to grow cotton in India, they just picked the seeds out by hand before they began to spin the cotton into thread. About 500 BC, cotton growers in India invented a machine with gears to turn rollers to get the seeds out of the cotton more quickly and easily.
Over time, people improved this machine, so that it could be run first by foot pedals and then by water power, using the current of a fast stream to turn the rollers.
When white people first began to grow cotton in North America in the 1600s AD, they brought over the cotton churka from India to help them get the seeds out. In the 1700s AD, people in the southern part of North America began to grow more and more cotton. Along the Atlantic coast, they could grow long-staple cotton, with long fibers that would work in the Indian cotton churka. But when people began to grow cotton further from the ocean, they found that the long-staple cotton didn't grow well there. They found a new short-staple kind of cotton, and grew that. But the old churkas wouldn't take the seeds out of this new short-staple cotton.
Cotton farmers forced African people to work as slaves and pick the cotton seeds out by hand. Mostly they made them do it in the evenings, after they'd already worked all day in the fields picking the cotton. This was too slow, and it made cotton very expensive - so expensive that nobody wanted to make clothes out of it.
This was a big problem, and a lot of people began to work on inventing a new kind of churka that would get the seeds out of short-staple cotton. Finally in 1793, just after the Revolutionary War, a young white man named Eli Whitney did invent a cotton gin that worked. It was a lot like the old churka, but it had steel teeth that caught the cotton fibers, and a system of pulleys to pull harder.
Cotton farmers all used the new cotton gin, and cotton clothing got so cheap that many people began to wear cotton instead of linen. Clothes got a lot cheaper, so that for the first time in history most people had more than one outfit to wear. The bad part was that in order to plant and pick so much cotton, the cotton farmers brought over thousands and thousands more African people to be their slaves and work in the cotton fields. Most of the African people who came to North America as slaves came because of the cotton gin.