The planets in the Solar System revolve around the Sun in almost circular paths called orbits. The Sun pulls the planets with the gravitational force,but the planets do not get drawn to the Sun but remain at certain distance because of the centrifugal force which acts in the outward direction (as the planets are revolving around the Sun). How did the planets start to revolve around the sun if they were attracted towards it (via the gravitational force)?
Firstly, there is no centrifugal force here. Centrifugal force is a fictitious force that you observe if you are rotating, in this case we don't need to have a rotating observer, so there's no centrifugal force.
The only force acting on the planets is a centripetal (inwards) one, gravity. Now, it's true that if the planets were stationary, then the centripetal force would pull them inwards and make them hit the sun. However, the planets have some tangential motion, so although they're "falling inwards" all the time, their tangential motion makes them constantly "miss" the sun, and hence continue orbiting.
I guess you are asking how the process of rotation has come about in the first place. Cosmologists believe that many billions of years ago, our solar system was nothing but a big cloud of dust and gas, which resulted from the explosion of nearby stars. We can deduce this because right now, at this very instance, astronomers are observing how new solar systems are evolving in different galaxies. It is believed that the initiate acceleration of this cloud of dusk and gas was caused by supernova's. In the process of millions of years, the dust particles clung together as a result of gravitational attraction, which eventually resulted in the formation of planets. The planets that are closest to the sun are much denser, because they are made up of rocks and heavy metals, which makes it possible for them not to melt (as a result of the heat). The outer planets are much less dense, they are basically made up of gas and ice.