Get proper training
Being comfortable underwater will go a long way towards having a safe dive. Proper training is one key to being comfortable underwater. The beginning of proper training is to get your open water certification. If you go diving in caves, caverns, wrecks, etc., you should also have the proper training for this type of dive. Don't dive beyond your ability.