The underwater environment plays a very big role in your photos. Just like nature photography on land, the location plays a big part in your chances of taking great pictures. Generally speaking, calm, shallow dive sites with good visibility make for the best spots for underwater photography.
Photographers seldom take the perfect shot at the first attempt. Calm conditions afford you the time you need time to compose your shot well, get the camera settings right and take a few shots of the same subject.
Staying shallow means, of course, that you can dive for longer, which means more time taking photos. It also means there is more light, which means more colour and more options in terms of the camera settings you can use and the styles of photograph you can take.
Good viz also means that you will have more light to play with and so more options. It also means less backscatter and clear, crisp images, saving you hours of editing time later.
Conditions of course change on a day to day basis, but picking a spot that has a reputation for consistently good conditions and some nice shallow reefs & subjects will give you a better chance of taking nice photos on every dive.