1706, originally a contraction of am not, and in proper use with that sense until it began to be used as a generic contraction for are not, is not, etc., in early 19c. Cockney dialect of London; popularized by representations of this in Dickens, etc., which led to the word being banished from correct English.
Something or someone emphatically is not Said as a wry and intensive negator in a comparative statement: My joint? Buckingham palace it ain't/ Well, she sings OK, but Barbra Streisand she ain't
[perhaps fr a Yiddish syntactic pattern]