Speech recognition takes the raw sound of a voice and converts it into written words. The system breaks the audio into tiny slices, finds the patterns that correspond to speech sounds, and assembles the most likely sequence of words, using knowledge of language to resolve ambiguity.
Accents, background noise and overlapping speakers make this hard, which is why accuracy varies with conditions. Modern systems learn from large collections of recorded speech, and they improve most on the kinds of voices and settings well represented in that data.