"Fail" has existed as a noun and has been part of our lexicon for a long time , such as in the phrase "without fail."
However, it gained a new meaning in the recent years with the fail Internet meme, where it started as an interjection first, capable of standing on alone in a sentence.
In fact, the first entry for "fail" to arrive on Urban Dictionary described fail as "an interjection used when one disapproves of something, or a verb" and one of the two examples cited was: You actually bought that?
FAIL.
If the "FAIL" above was a noun, that sentence would not be syntactically correct.
Nouns cannot be used in that manner.
It would be like saying: You positioned your lips to form an upward curve?
SMILE.
We understand what is meant
but it's not syntactically correct.
No one with a good command of English would ever say such a sentence.
A correct way to articulate the thought
while keeping "smile" as a noun would be to say: You positioned your lips to form an upward curve?
That's a smile.
Therefore, the fail in the Urban Dictionary example is an interjection.
It's only afterward, probably through misinterpretation of the meme, that it came to be used as a noun.
When you look at an image with only "FAIL" written on it, it's impossible to tell whether fail is being used as a noun or an interjection: From that point on, the meme evolved - as memes often do - and started to be used as a noun , as an adjective , and as a noun modified by as an adjective .
As for the origin of the meme itself, which I assume is your original question, the origin most often given (by
Know
Your Meme , Slate , and the New York Times ) is that it comes from a poor Japanese-to-English translation of the game Blazing Star.
Ben Zimmer of the New York Time says: This punchy stand-alone fail most likely originated as a shortened form of “You fail” or, more fully, “You fail it,” the taunting “game over” message in the late-’90s Japanese video game Blazing Star, notorious for its fractured English.
For reference, here's Blazing Star's game over message:
english.stackexchange.com/users/3711/Borror0
Online Etymology Dictionary says: Fail: The noun (e.g. without fail ) is from late 13c.
, from O.Fr. faile "deficiency," from falir .
The Anglo-French form of the verb, failer , came to be used as a noun, hence failure .
english.stackexchange.com/users/127/Mehper C. Palavuzlar
adding to Mr Mehper's answer, people use it in the stock and security market too.
to mean: Failure to deliver securities to a purchaser within a specified time.
Failure to receive the proceeds of a transaction, as in the sale of stock or securities, by a specified date.
english.stackexchange.com/users/3914/Fiona Cheung
The recent uprise in incidences of non-verb fail is due to its being an internet meme, possibly from a Japanese video game with poor translation to English.
Know your meme .
english.stackexchange.com/users/39/nohat
Although "fail" has been used sparingly in the past as a noun (e.g. "without fail"), there is evidence that the word is creeping toward ordinary usage as a noun to replace the word "failure."
I just read the following headline in Bloomberg Businessweek (6/6/11-6/12/11 issue):
"How Stephen Elop is trying to lead Nokia past its epic fail."
My first reaction was that perhaps the word is only used to draw attention in headlines, but that it would not breach the body of the article.
Well, the word did appear once inside the piece.
"Fail" (as an ordinary noun) is coming into our campsite, ladies & gents.
Hey, compared to "refudiate," it's a gem!
english.stackexchange.com/users/9588/Bob
Some hypotheses are listed and briefly analyzed in this Slate article.
english.stackexchange.com/users/2396/WAF
Fail has been used as a noun with a quite different meaning by Rev John Davidson,DD in his book 'Old Aberdeenshire Ministers and their people' 1895.He
describes a parish school built in a day with dry-stone walls topped with FAIL or divot and a roof of open rafters covered by thatch.
english.stackexchange.com/users/106492/Dr W Leslie Alexander
Does anyone know when and how  fail  became a noun?  I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
When and how did "fail" become a noun?
english.stackexchange.com
<nouns><language-evolution>
english.stackexchange.com/questions/9657
english.stackexchange.com/users/1778/ukayer
The word "fail" has existed as a noun for a long time, such as in the phrase "without fail" and in fact, according to Online Etymology Dictionary, the word "fail" as a noun dates from the late 13th century. However, there is evidence that the word is creeping towards usage as a noun to replace the word "failure".  "Fail" has been part of the English lexicon for some time. More recently it has gained traction as a noun through internet memes and a poor translation of  a Japanese video game into English. Its use as a noun is increading. However, when "fail" is used with an image sometimes it is not clear if the verb or noun is being used and it would seem that "fail" is gradually coming to replace the noun "failure".  Etymologically, "Failure" comes from the Anglo-French form of verb "failer" dating back to 13th century
The word "fail" has existed as a noun for a long time, such as in the phrase "without fail" and in fact, according to Online Etymology Dictionary, the word "fail" as a noun dates from the late 13th century. However, there is evidence that the word is creeping towards usage as a noun to replace the word "failure".  "Fail" has been used as a noun for a long time, although it has become more popular in Internet memes as a standalone interjection or expression of disapproval.
Online Etymology Dictionary  says that the noun "fail" dates from late 13th Century. The word "fail" appears to have been used as a noun since around the 13th century.
It has been in the lexicon for a while. It gained a new meaning recently due to internet "memes" However, it is not clear if a noun or verb is being used. It can be determined if it is a noun or interjection when used on an image. Its origin is from a  game called "Blazing Star" Etymologically goes back to 13th centry. Failure came from Anglo-French Creeping use as a noun.
"Fail" has been used as a noun for a long time, although it has become more popular in Internet memes as a standalone interjection or expression of disapproval.
The word "fail" appears to have been used as a noun since around the 13th century.