The 4th one, in Germany, took 2 years.

Famously regulated to hell Germany. There is no way that Nevada and NY have more regulations than Germany. It really is all about having experience.

Gigafactory Nevada notably became the second-largest building in the world (by volume) and was a joint partnership with Panasonic, locating two major manufacturing facilities within the same structure. Seems like a big project with additional joint partner complexities. Making the second largest building in the world as your first try is going to maybe run into some things.

Gigafactory Berlin is a different beast and produces a different product mix.

Gigafactory New York produces photovoltaic cells and Tesla Supercharger assemblies but does not produce batteries or vehicles yet another product mix.

Giga Shanghai just does final vehicle assembly (basically the easiest kind of factory and most minimally regulated) and is a million square feet smaller than the other factories and with no joint partnership/co buildout.