Einstein realized that uniform acceleration is indistinguishable from a homogeneous gravitational field (the principle of equivalence) through the Einstein Elevator thought experiment.
Like Conifold said, Einstein's original insight didn't involve an elevator, it involved a man falling from a roof. This was his "happiest thought", in 1907, wherein the falling observer doesn’t feel his own weight. The Wikipedia article Conifold linked to talks about it. Einstein didn't start talking about elevators until much later. You can search the Einstein digital papers on elevator. Note the dates. You can also search on chest and find chapter 20 of Relativity: The Special and General Theory. That's where he talks about a spacious chest resembling a room with an observer inside. He also said "to the middle of the lid of the chest is fixed externally a hook with rope attached, and now a "being" (what kind of a being is immaterial to us) begins pulling at this with a constant force". Einstein wrote this book in 1916, and it was translated into English in 1920.
From the thought experiment, the physicist will not be able to tell the difference between whether he is homogenous gravitational field or if he is in gravitation free space in uniform acceleration.
That's right, but do note that the homogeneous gravitational field is an idealization. In chapter 20 of Relativity: The Special and General Theory Einstein said it’s “impossible to choose a body of reference such that, as judged from it, the gravitational field of the Earth (in its entirety) vanishes”. Also see this where Einstein says special relativity is nowhere precisely realized in the real world. In the real world, there are no homogeneous gravitational fields, and a gravitational field is in itself space which is neither homogeneous nor isotropic.
How did Einstein generalise this one case to conclude as a whole that uniform acceleration creates a uniform gravitational field? This is a fundamental part of general relativity.
He didn't, and it isn't. See Kevin Brown‘s mathspages article on the many principles of equivalence where you can read that the equivalence principle has undergone several changes over the years. Brown says this: “the modern statement of the strong equivalence principle, of the assertion that the laws of physics are the same for all frames of reference (i.e. independent of velocity) is also conceptually quite distinct from the original meaning of Einstein’s equivalence principle”. He's saying the equivalence principle isn't Einstein's equivalence principle. See the Einstein equivalence principle section of the Wikipedia equivalence principle article. It says “the outcome of any local non-gravitational experiment in a freely falling laboratory is independent of the velocity of the laboratory and its location in spacetime”. That isn’t Einstein’s equivalence principle either.
John D Norton talked about this in his 1985 paper what was Einstein’s principle of equivalence? He said it was a special relativity principle that dealt only with fields that could be transformed away. He talked of an old view and a new view, and said “the equivalence of all frames embodied in this new view goes well beyond the result that Einstein himself claimed in 1916”. This is why on pages ix and x in his 1960 preface to relativity: the general theory, John Synge said the equivalence principle performed the essential office of midwife at the birth of general relativity, but should “be buried with appropriate honours”. In a nutshell, a lot of what you hear about the equivalence principle isn't historically accurate. See my own article on the principle of equivalence and other myths for further details and references.
Is it linked with the law of conservation of mass and energy?
Not really. People don't agree about the conservation of energy in general relativity. I think it applies full stop, but not everybody shares that sentiment. And there is no law of conservation of mass. If you drop a brick some of its gravitational potential energy, which is mass energy, is converted into kinetic energy. When the brick hits the ground this kinetic energy gets dissipated, leaving you with a mass deficit. See the Wikipedia binding energy article for more on that.