This page of science fiction firsts mentions the first story of a "robot without a master" that they were able to find was "Robot--Unwanted" by Daniel Keyes from 1952, although from the title and illustration this was probably just about a single free robot. Searching on google books for that title, I found p. 205 of Partners in Wonder: Women and the Birth of Science Fiction, 1926-1965 discusses some other early stories dealing with robots trying to achieve independence, including "Robots of the World! Arise!" by Mari Wolf which appeared in the July 1952 issue of Worlds of IF, available on project gutenberg here. However this may not be quite what you're looking for since it's a story about robots trying to gain independence, as opposed to a story showing AIs that have already achieved this and are living independently. Another example mentioned in Partners in Wonder which more clearly matches your criteria, whether or not it's actually the first, would be the comic book story "Judgment Day" by Al Feldstein, from Weird Fantasy #18, March/April 1953 (reprinted in this collection). Here's the description:
an Earth astronaut was sent to Cybrinia, a robot populated planet, to determine if the intelligent robots there were ready to join the Earth's Galactic Republic. He found that Cybrinia was a color-segregated society, with the dominant orange robots subjecting blue robots to ghettos and economic discrimination. The astronaut decided that Cybrinia could not joint the Republic until its robots learned, like the people of Earth, to live together without prejudice and discrimination. After the astronaut returned to his ship, he removed his helmet to reveal himself as a handsome black man with "the beads of perspiration on his dark skin twinkling like distant stars."
There is also the much earlier 1872 story Erewhon by Samuel Butler, which doesn't actually show intelligent self-replicating machines but features a character talking about the possibility as the reason their society had banned machines. The story is available on project gutenberg here, the next three chapters XXIII-XXV are the one on machines. At the end of the previous chapter XXII the author mentions that the people of Erewhon had 500 years earlier had a "revolution which had ended in the destruction of so many of the mechanical inventions which were formerly in common use", and that the revolution was in large part inspired by a book warning of the dangers of machines, which the author quotes from and summarizes in the next three chapters, you can see that the author warned that machines might both develop human-like consciousness and that they might begin to reproduce themselves:
“There is no security”—to quote his own words—“against the ultimate development of mechanical consciousness, in the fact of machines possessing little consciousness now. A mollusc has not much consciousness. Reflect upon the extraordinary advance which machines have made during the last few hundred years, and note how slowly the animal and vegetable kingdoms are advancing. The more highly organised machines are creatures not so much of yesterday, as of the last five minutes, so to speak, in comparison with past time. Assume for the sake of argument that conscious beings have existed for some twenty million years: see what strides machines have made in the last thousand! May not the world last twenty million years longer? If so, what will they not in the end become? Is it not safer to nip the mischief in the bud and to forbid them further progress?
“It is said by some with whom I have conversed upon this subject, that the machines can never be developed into animate or quasi-animate existences, inasmuch as they have no reproductive system, nor seem ever likely to possess one. If this be taken to mean that they cannot marry, and that we are never likely to see a fertile union between two vapour-engines with the young ones playing about the door of the shed, however greatly we might desire to do so, I will readily grant it. But the objection is not a very profound one. No one expects that all the features of the now existing organisations will be absolutely repeated in an entirely new class of life. The reproductive system of animals differs widely from that of plants, but both are reproductive systems. Has nature exhausted her phases of this power?
“Surely if a machine is able to reproduce another machine systematically, we may say that it has a reproductive system. What is a reproductive system, if it be not a system for reproduction? And how few of the machines are there which have not been produced systematically by other machines? But it is man that makes them do so. Yes; but is it not insects that make many of the plants reproductive, and would not whole families of plants die out if their fertilisation was not effected by a class of agents utterly foreign to themselves?
“It is possible that the system when developed may be in many cases a vicarious thing. Certain classes of machines may be alone fertile, while the rest discharge other functions in the mechanical system, just as the great majority of ants and bees have nothing to do with the continuation of their species, but get food and store it, without thought of breeding. One cannot expect the parallel to be complete or nearly so; certainly not now, and probably never; but is there not enough analogy existing at the present moment, to make us feel seriously uneasy about the future, and to render it our duty to check the evil while we can still do so? Machines can within certain limits beget machines of any class, no matter how different to themselves. Every class of machines will probably have its special mechanical breeders, and all the higher ones will owe their existence to a large number of parents and not to two only.
“We are misled by considering any complicated machine as a single thing; in truth it is a city or society, each member of which was bred truly after its kind. We see a machine as a whole, we call it by a name and individualise it; we look at our own limbs, and know that the combination forms an individual which springs from a single centre of reproductive action; we therefore assume that there can be no reproductive action which does not arise from a single centre; but this assumption is unscientific, and the bare fact that no vapour-engine was ever made entirely by another, or two others, of its own kind, is not sufficient to warrant us in saying that vapour-engines have no reproductive system. The truth is that each part of every vapour-engine is bred by its own special breeders, whose function it is to breed that part, and that only, while the combination of the parts into a whole forms another department of the mechanical reproductive system, which is at present exceedingly complex and difficult to see in its entirety.
“Complex now, but how much simpler and more intelligibly organised may it not become in another hundred thousand years? or in twenty thousand? For man at present believes that his interest lies in that direction; he spends an incalculable amount of labour and time and thought in making machines breed always better and better; he has already succeeded in effecting much that at one time appeared impossible, and there seem no limits to the results of accumulated improvements if they are allowed to descend with modification from generation to generation.
Much of the discussion in these chapters is a somewhat reworked version of an 1863 essay Butler had published titled "Darwin among the Machines" (online here), you can see a summary with quotes from both on the wikipedia page about the essay.