How did Albert Einstein come up with the idea of the atom bomb?

Although the underlying theory of the atomic bomb workings draws loosely from Einstein's ideas on mass to energy conversion (the famous equation E=Mc2), he did not himself invent the atomic bomb neither did he himself discover fission. Leo Szilard invented the neutron chain reaction that makes both bombs and reactors possible, but Einstein knew nothing of this as the British kept the patent classified from 1936 until 1949. Einstein was an absolute pacifist and refused to participate in any type of war related work.

Before WWII Szilard wrote a letter and had Einstein sign it (as if he had written it) to warn President Roosevelt that Germany was likely working toward the development of an atomic bomb. Shortly after this the US started a project to beat the Germans to the development of this weapon.

The atomic bomb was the product of cooperation of many scientists and engineers participating in the Manhattan project. Chief among the people who unleashed the power of the atom was Robert Oppenheimer, who oversaw the project from conception to completion.

Enrichment of the U-235 from U-238 was conducted at Oakridge Tennessee. Harold Urey and his team at Columbia University devised an extraction system using the principle of gaseous diffusion.

Production reactors to make Pu-239 were built and operated at Hanford Washington.

Bomb casing development was done at Wendover Utah and in southern California.

Production of different parts was contracted out to several dozen companies. Often as the companies were not given information on the things their part attached to (for secrecy) things did not fit right and had to be reworked in the field. For example wartime MK-III Fat Man bombs were virtually custom built with no interchangeable parts. Even the Plutonium core of one bomb would not fit in the pit of others.