Every language has perfunctory linguistic tokens meant to accompany or acknowledge an act of some kind. The expression of thanks and its customary retort are perhaps the most common such species in the class of what are called performative speech acts. Sometimes these tokens are old enough to have grown opaque to the point of meaninglessness, as with the word welcome uttered by itself or in the phrase from which it is derived, you are/ you’re welcome, as a polite formula used in response to an expression of thanks. This formulaic utterance seems to have originated in American English in the beginning of the 20th century but has since spread to other varieties of English.

All the European languages also have some variety of acknowledgement of thanks that is equivalent to English not at all, don’t mention it, e.g., Spanish de nada, German (das) macht nichts, Russian ne stoit (не стóит [благодарности]), etc. In contemporary colloquial American English one also often hears no problem with the same function.

The linguistically most interesting of these specimens is undoubtedly you’re welcome because welcome has such a wide range of meanings. Here is its etymology from The Oxford English Dictionary Online:

Etymology: Originally Old English wilcuma ( < wil- , will- will, desire, pleasure + cuma comer, guest) = Old High German willicomo , Middle High German and Middle Low German willekome , -kume (whence Old French wilecome ), with subsequent alteration of the first element to wel- well adv. and n.4, and identification of the second with the imperative or infinitive of the verb come, under the influence of Old French bien venu, bien veigniez, Latin bene venisti, bene venias, etc., . . . .

Why welcome as a response to the expression of thanks? The first interpretation that comes to mind is the gloss “your thanks are welcome,” wherein the component “your thanks” is understood to have become identified with the UTTERER, hence “you’re/you are welcome.” In other words, just as in the case of “thanks” as a reduced form of “my thanks” or “I thank you,” you’re welcome is at bottom a product of TRUNCATION. Otherwise it makes no grammatical sense. But such quasi-meaninglessness is typical of linguistic tokens that are purely performative.