You get the diving mask in Horizon Forbidden West during the main quest called The Sea of Sands, which is one of the three subordinate function quests unlocked at the end of The Eye of the Earth main quest. The Sea of Sands is the quest to find the POSEIDON subordinate function. You don’t need to complete the whole of The Sea of Sands to get the diving mask, just up to the “Craft the Diving Mask” objective.
On the west side of the ruins of Las Vegas, you’ll find a building called The Tower of Tears. Inside there’s a team of delvers trying to retrieve salvage from the flooded area below the building. One of them, Morlund, has invented and built a “diving bubble,” but there’s a lot of room for improvement in its design. Your next objective is to find the required parts to make a superior diving device.
You might be tracking the machine herd around the desert for a while. Just know that the Frost Bellowback is the machine you have to kill because it’s the one from which you can loot a synthetic membrane. Once you’ve got that, head back to The Tower of Tears and dive into the flooded room on the west side of the building. Be very quick and direct in your diving and surfacing when you retrieve the compressed air capsule — the dive will push your capacity to hold your breath to the limit.
Take the parts to Morlund, then use them to build the diving mask at his workbench. Go to Special Gear and select the diving mask to build it.