With a space: under_water.
My Webster says it can be also underwater without a space.
Your dictionary says underwater is an adjective - (an underwater grotto).
Here, under water is an adverbial phrase.
BC is right.
Rover
Merriam-Webster online appears to be your first source and it does include the phrase "underwater - adverb." But no example of adverbial usage is provided. The link just takes me back to the adjectival definition.
The citation for your example "He dived underwater and swam away" appears to be Longman Dictionary of Contemporary English online.
Okay so says Longman, but I have never heard underwater used as an adverb in my life, nor can I find an adverbial use in a quick search of the British National Corpus.
Don't use "underwater" as an adverb. Use "under water".
underwater
adjective
adverb
/ˌʌn.dəˈwɔː.tər/
/-dɚˈwɑː.t ̬ɚ/
"under the surface of the water, especially under the surface of the sea
an underwater camera (= a camera that you can use under water)
Some species of turtle can remain underwater for 24 hours."
Definition of underwater adjective/adverb from Cambridge Dictionary Online: Free English Dictionary and Thesaurus