Hydra's origin according to Marvel's Wiki:
The man most responsible for the creation of Hydra was Baron Wolfgang von Strucker, the Prussian aristocrat who served as wing commander of Nazi Germany's infamous Death's Head Squadron, and later as leader of its Blitzkrieg Squad of commandos. Infuriated by Strucker's defeats by American commando Sgt. Nicholas Fury, and by Strucker's refusal to execute the entire population of a French village, Adolf Hitler ordered the Gestapo to find and assassinate him. Strucker escaped Germany with the help of some of its men, and more importantly, with that of the Third Reich's second most powerful leader, the Red Skull. The Skull eventually intended to challenge Hitler himself, and assigned Strucker to build a power base for him in the Far East. The embittered Strucker had no intention of serving anyone but himself, however, and severed ties with the Skull on becoming the Supreme Hydra.
More on Marvel.com:
https://marvel.com/universe/Hydra#ixzz4f5o0KsE4
So yes, the main faction started out as part of the Nazis and splintered off.
Before the evolution of mankind, a cabal of immortal hooded reptoids came to Earth, planning to start a legacy of evil.[3] Millions of years later, they corrupted an Asian secret society of geniuses known as the Brotherhood of the Spear, which resulted in that group being called "the Beast" by the Brotherhood of the Shield.[4] The corrupted Brotherhood of the Spear spread out, ingraining itself like a multi-headed serpent into all facets of human society, from science to magic and politics. As time wore on, the organization's name changed and it included the Cathari sect as well as the Thule Society.[5] The Nazi sub group, funded by the Thule Society, was brought into the main Hydra fold after the end of World War II.[6]
One of the Nazi members, Baron Wolfgang von Strucker, quickly seized control of the Hydra organization and restructured it to be dedicated to world domination through terrorist and subversive activities on various fronts, resulting in a neo-fascist New World Order. To this end, Baron Strucker used his personal fortune, based on his recovered hoard of Nazi plunder from World War II, and funds established by the original leaders of the Japanese secret society that became part of the old Hydra.[6] However, after Strucker's first death, Hydra broke into factions (such as AIM, Secret Empire, Them, etc.) that each adopted its own reorganized modus operandi.[6] Eventually, this fragmentation would lead to a Hydra civil war, even after Strucker's resurrection.