A soybean cultivar designated S170021 is disclosed. The invention relates to the seeds of soybean cultivar S170021, to the plants of soybean cultivar S170021, to the plant parts of soybean cultivar S170021, and to methods for producing progeny of soybean cultivar S170021. The invention also relates to methods for producing a soybean plant containing in its genetic material one or more transgenes and to the transgenic soybean plants and plant parts produced by those methods. The invention also relates to soybean cultivars or breeding cultivars, and plant parts derived from soybean cultivar S170021. The invention also relates to methods for producing other soybean cultivars, lines, or plant parts derived from soybean cultivar S170021, and to the soybean plants, varieties, and their parts derived from use of those methods. The invention further relates to hybrid soybean seeds, plants, and plant parts produced by crossing cultivar S170021 with another soybean cultivar.