In Assassin's Creed: Odyssey, sharks guard access to various underwater locations, i.e. ruins or shipwrecks. This means that you will have to kill them. Read this page to learn how to kill sharks.
You can determine the location of sharks before entering the water by helping yourself with Icaros. The eagle will mark sharks in the same way as you mark enemies and wild animals on land. You'll also know the level of sharks, of course.
Sharks can be attacked before you dive. You can stop as soon as you get close enough to them and start using the bow (while floating in the water). If you want to protect yourself even more, swim to the shark location with your boat so you won't touch the water when you shoot.
The second option is to attack sharks underwater. Then, the hero uses a white weapon to launch attacks. Do not interrupt them until the shark dies. Try to deal with the shark quite fast so that you don't run out of air before returning to the surface.