How did the sun wind up in the middle of the solar system? Did the materials, gas and dust that eventually formed the planets come from the sun?

I think this is the answer is it correct-

Since our solar system is already formed, we must try to reconstruct its history by studying current star formation in our local neighborhood, the Milky Way galaxy.

some one said that was the answer

The sun is in the "middle" because it has the most mass: Sun is so massive that as planets rotate around, the Sun does not move (much).

To explain how the Sun ended up in the middle of the solar system, we need to consider the process of star formation. About 4.6 billion years ago, a vast cloud of gas and dust called a nebula was present in our galaxy, the Milky Way. Under the influence of gravity, this nebula began to collapse and spin due to tiny imbalances in its density.

As the cloud collapsed, it started to flatten into a rotating disk shape. The central region of this disk, where most of the matter accumulated, eventually became the Sun. The materials that formed the Sun primarily came from this collapsing nebula, not from pre-existing stars. This is why the Sun contains the majority of the mass in our solar system.

At the same time, other regions within the disk started to clump together due to gravitational forces. These clumps of gas and dust gradually accumulated more matter and formed what we call protoplanetary disks. Over time, these disks underwent further condensation and collision, leading to the formation of planetesimals, which eventually grew into planets.

The reason the Sun remains in the middle of the solar system is due to its enormous mass. The gravitational pull of the Sun is significantly stronger than that of any other object in our system. As a result, the planets, asteroids, comets, and other celestial bodies revolve around the Sun in elliptical orbits, while the Sun itself remains relatively stationary.

To study the formation of our solar system, scientists observe other star-forming regions in the Milky Way galaxy. By examining these regions, they can gather valuable insights into the processes that occurred billions of years ago and led to the formation of our Sun and its surrounding planets.