There are thousands of different languages and ways you could build a web site. Some are more popular than others, and some require specific tools or technologies.
Its popularity has a lot to do with Rails being particularly well suited to building web sites. You can make a working prototype of an idea pretty quickly, and then build out from that. It has addressed a lot of the problems you can run into on a large web project. Think of Rails as a gateway drug – you play around, build a few things, and get into Ruby- which is a very “that makes sense” language.