You can do this on a freelance basis where you shoot a lot of images and then sell them or you can shoot by assignment where you shoot specific subjects. No matter where you want to get started, you're going to need a strong commercial photography portfolio.
If you're not sure what you want to focus on, you should consider taking a wide variety of photographs that will show off your photographic flexibility. This will also increase the chances of a buyer seeing something they like. Remember that any photographs featuring people will need to have signed releases allowing you to sell the images, so it may be best to focus on environments and products when you're first getting started.
There are two reasons that the Internet is your most powerful ally in building a commercial photography portfolio. The first is that it allows you to search through the portfolios of thousands of working commercial photographers and see what sorts of images sell the best. The second is that it provides you with a low-cost way to get your portfolio to as many people as possible. Simply get a website domain name and upload your photos, then send the link with any correspondence to potential buyers.
You're not going to have assignments right out of the gate, but a good way to get them is to shoot in the vein you're interested in to demonstrate your abilities. Then put them on your portfolio explaining how they interact with the campaign and why you selected them. Art directors love a photographer that can think "in theme."
One of the best ways in which you can profit from photography is by becoming the best photographer at certain kinds of photographs. There are photographers who focus just one subject matter like food, celebrities, animals, models, and many others. Find something you're passionate about, grab a few publications you'd like to shoot for, and see if you can build a portfolio of work that speaks to that potential client.
Beginning photographers may find it difficult to lock down work with a major publication, but there are thousands of local ones that often get overlooked. Find out if there are any local magazines, newspapers, or websites that need images that you can offer. Commercial photography is a hard market to break into, but with the right mindset and an eye for local needs, you may find it easier than you thought.