Actors have in the past stated that they were able to perform without any breathing apparatus, but most of this is probably hyperbolic and in most cases can be attributed to clever editing.
In filming the extended underwater sequence of Mission Impossible Rogue Nation, Tom Cruise has claimed he held his breath for up to 5 minutes.
Cruise, who reportedly trained to hold his breath for six and a half minutes underwater in Mission: Impossible — Rogue Nation, shared the process of filming the extreme stunt. “You get rid of the regulator, get rid of the bubbles, get on the side and we wanted to do it one shot, so they were very, very long shots,” said Cruise. “I’d have to hold it consistently, you know safely, up to four minutes almost for every take.”
Despite hours of training and even learning to slow his heart rate down, Cruise explained performing the actual stunt was “not pleasant.” “I trained for a long time to the point that when I finished the sequence, there’d be times I’d be sitting there talking in meetings and I wouldn’t breathe,” he said. “I realized I am not breathing and I had to turn my autonomic system back on to breathe again.”
However, even if this is true it should absolutely be treated as the exception, and most film makers will simply be creative in how they choose to film and how they edit. Different film makers will use different techniques, which are in turn dependent on variables.
Almost all underwater shots are done in 'a tank', as opposed to out in actual open water. Not only is this less cost prohibitive, but it also allows the film maker control over consistency of conditons: lighting chief among them. This is often also the case when shooting with water at all, infact.
Tanks are typically useful for creating the deception of the actor being deeper underwater than they actually are, but when an actor needs to go deeper and cannot surface for air, a diving team is typically used.
The following scenes are from the production diary of Atonement. The shot below of Keira Knightley sees her submerged only a few feet underwater, but in order for her not to constantly have to reset her position she was given a diving team (just out of shot, to the left):
In this shot, she is being provided with oxygen between takes. It is much easier for the diving time to get out of frame than for Keira to surface, gulp air, dive and get back in position for another shot.
When using tanks, greenscreens/bluescreens and Chroma Key are used to modify the background in post production.