A distinction developed by Noam Chomsky beginning in his 1965 book Aspects of the Theory of Syntax in which he outlines what he believes the goals of Linguistics should be.

A quote from the book:
Linguistic theory is concerned primarily with an ideal speaker-listener, in a completely homogeneous speech community, who know its (the speech community's) language perfectly and is unaffected by such grammatically irrelevant conditions as memory limitations, distractions, shifts of attention and interest, and errors (random or characteristic) in applying his knowledge of this language in actual performance. (Chomsky, 1965, p. 3)

Chomsky argued that linguists should study only the underlying representations of language, and specifically of their own language (he believed that until linguists understand their own language, they cannot understand language in general; this is why he devoted so much of his career to the analysis of English syntax.) In order to illustrate that this is not a flawed knowledge (in native speakers) the way that he believed naturally occurring data to be, he created a distinction between what speakers know and what they might say.

Competence is the knowledge you (subconsciously) possess about how to speak a language.

Performance is your real world linguistic output. Performance may accurately reflect competence, but it also may include speech errors due to slips of the tongue or, as Chomsky points out in the quote above, external factors such as memory problems, etc.

To understand this distinction, it is helpful to to think about a time when you've made some sort of error in your speech. For example, let's say you are a native speaker of English and utter the following:
We swimmed in the ocean this weekend.

As a proficient speaker, it isn't that you don't know that the past tense of swim is swam, you've just mistakenly applied the regular rule to an irregular verb. You're unlikely to make this kind of error more than a small portion of the time, and may never say "swimmed" again. Your competence is fine - you know how to conjugate irregular English verbs, it is your performance that has let you down.

Though linguists have since realized that competence is not the only thing worth studying in Linguistics (thanks to contributions of linguists like William Labov, who popularized sociolinguistics), but the distinction remains useful, primarily because it allows those studying language to differentiate between a speech error and not knowing something about a language. Linguists use this distinction to illustrate the intuitive difference between accidentally saying swimmed and the fact that a child or non-proficient speaker of English may not know that the past tense of swim is swam and say swimmed consistently.


References
The Victoria A. Fromkin Speech Error Database, http://www.mpi.nl/world/corpus/sedb/
Chomsky, Noam (1965). Aspects of the Theory of Syntax. MIT Press, Cambridge.