(1) Go to the website of a domain registrar. These are the companies who sell domain names.
(2) Follow their instructions to purchase a domain name.

That's the short answer. However, to be honest, if you didn't already know this then it sounds like you have an awful lot yet to learn. You'll need to invest a lot of time learning all about how websites work, how domains work, who controls them and what you need to know to manage a domain. There's far more to it than I can relate in a forum post. So get googling and learning, and good luck.

A domain name is simply the primary name of a website. It really helps if you already have an idea of what your website is going to be about. Are you going to have a site about dogs? Fruit? Fishing? One particular Sony TV? So let's take dogs and see what we can come up with. Obviously dopgs.com is taken as are dogs.net and dogs.org.

Domain name can be not created by us but we have to purchase it from domain registrars. You have to search for your domain name for whether it is available or not.

Let me give you one example.

If you want to buy a domain www.xyz.com then you have to open any domain registrarís website like Godaddy.com and then search for that domain name availability. If the domain name is available with .com extension then it will show you that this domain is available otherwise you have to choose another extensions like .net, .co, .org or something like that. Once you made your selection you just have to click on buy/purchase now button and pay the require amount and that's it. Domain registrar will send you an email with its credentials and other information.