Mostly with underwater cameras and divers mixed with Computer Generated Imagery (CGI).
- This particular scene looks to be filmed completely underwater with a
shark model. Nowadays they would simply film the water surface and add a CG
shark later. CG effects grow better and they just make complete scene with CG.
- When there is a need to film an actor in water the scene is shot in a swimming pool
and cover the background with green screen so the CG can make it seem they are deep in the water or in some other location.
Behind the cameras there is full team in scuba gear. The scene is shot in many little pieces depending how long actors can hold their breaths before they surface or are given an air tank. When the video is cut and other camera angles added it appears as they never left the water.
When an actor's face is not visible, a professional "breath hold" diver is shot in the scene in one continuous roll.
Here you can see how they filmed Harry Potter underwater.