A man has died after being mauled by a shark while swimming at a popular beach in the state of Western Australia.