How does a gas giant planet form like Saturn and Jupiter, and why just gas? Why didn't they form any solid surface?
As @RobJeffries says, this information is mostly in the relevant wikipedia article.
The answer is really in two parts:
Firstly, they don't have solid surfaces because the elements they are made of don't have solid forms at the temperatures and pressures that arise inside the planets. In particular, Jupiter and Saturn are made mostly of hydrogen and helium which only become solid at rather low temperatures and the planets are still hot due to the heat created by their formation, heating from the Sun and some heat released by internal processes.
This, of course, begs the question of why those two planets are made mostly of hydrogen and helium, when the others are not. I should start with the caveat that a lot of aspects of this are still areas of active research and debate among scientists, and could not be considered settled or universally accepted. As more evidence is gathered and computer models (used for making checkable predictions from underlying theories) are refined,views of this may change.
So the solar system started out as a cloud of gas and dust. While it was mostly hydrogen and helium (still around since the big bang) it had significant amounts of other elements present in it which had been produced in older generations of stars. Some chance concentration of mass, or external shock (eg from a supernova) caused it to start to collapse and, under the influence of its own gravity, fluid dynamics and the conservation of angular momentum, a large part of it formed a ball (called a protostar) at the centre which was heated up by the collapse process itself. Around that, gas and dust formed a flat disk (oriented according to the original net angular momentum of the clump). Within that disk, tiny grains of solid matter formed. Far from the protostar, those grains were mostly made of compounds relatively light elements (carbon, oxygen, nitrogen, hydrogen) which we collectively call "ices". Closer to the protostar, its heat stopped ices from solidifying, but still allowed grains of iron, rock-like materials and so on.
When these grains collided, they stuck together, gradually forming bigger and bigger lumps. In the outer system they were lumps of ice, a lot like comets, in the inner system, something more like lumps of rock (like some asteroids). These then started holding together and pulling in more material by their own gravity and eventually grew into planets. At some point during this process fusion started in the Sun, and drove awat most of the remaining gas and dust. After that the planets grew by collisions.
So in the inner system, you got rocky planets like Mercury, Venus, Earth and Mars. A bit further out you got icy planets like Uranus, Neptune and Pluto. A couple of those icy planets happened to get big enough, quickly enough, to attract a lot of hydrogen and helium gas before the Sun lit up. They are Jupiter and Saturn.