In Genesis chapter 2 we are told that God created one man (Adam) and one woman (Eve). Adam is reported as having sons and daughters in Genesis 5:4. Cain must have married one of these or another close relative descended from Adam. By the time Adam died, he not only had children and grand-children, but he had great-great-great-great-great-great grandchildren.
There is evidence that marriage between brothers and sisters was allowed in the Genesis period. For example, Abraham married his half-sister Sarah (Genesis 20:2,12).
For an alternative view, see Did God create other people besides Adam and Eve?.