Sun like stars form when part of a dust cloud begins to contract under its own gravitational force; as it collapses the center becomes hotter and hotter until nuclear fusion begins in the core.
When an interstellar cloud starts to contract probably triggered by shock or pressure wave from a nearby star it fragments into smaller pieces. The individual cloud fragments begin to collapse. Once the density is high enough there is no further fragmentation. The interior of the fragment starts heating and is about 10000 K.
The core of the cloud is now a protostar and makes its first appearance on the H-R diagram. The protostars luminosity decreases even as its temperature rises because it is becoming more compact.
Once the core reaches 10 million K nuclear fusion begins. The protostar becomes a star. The star continues to contract and increase in temperature until it is in equilibrium. The star has now reached the Main Sequence on the H-R diagram and will remain there as long as the hydrogen in its core fuses into helium.
An interstellar cloud typically forms many stars as a star cluster. Our Sun is believed to have formed in a star cluster the Pleiades some 4.5 billion years ago.