Any time you have a large cloud, different parts of it will randomly be moving in different directions. If you pick any line through the middle to consider, slightly more particles might be moving (say) clockwise than counterclockwise around that line, just by chance. And there has to be some axis where that random difference is the largest.
Over time, the gas and dust may start to contract under its own gravity. Like a spinning skater pulling in their arms, the rotation will speed up, and there will be collisions so that over time there will be a consistent rotation in a certain direction, just arising from the original random motions.
Instead of producing the gravity, it kind of does the opposite thing. The objects really want to move in straight lines, and gravity is the only thing that keeps pulling their paths around the middle. If there were no motion, the objects would just fall straight down towards the middle, so in that sense, the rotation is acting against the gravity. Explanations of the formation of the solar system mention the rotation of the initial cloud because it was the precursor to the revolution of the planets about the sun, along with the rotations of the planets and of the sun itself. It is not because the rotation somehow creates the gravity.
When you spin an object, things inside it swing out towards the edge. That's really just their momentum carrying them in a straight line until (say) the wall of the can gets in the way. But if you're in a spinning room and the wall is constantly keeping you from flying off in a straight line, it kind of feels like gravity is pushing you against the wall. But it's not gravity, just the wall pushing inward on you and steering you in a circle. The inward force of the wall is called centripetal, and the outward force that you perceive is technically not a true force, but it is a meaningful concept called centrifugal force. But, again, it is a very different thing from gravity.