A man in Western Australia has been charged after allegedly attempting to drown his five-year-old son at a Pilbara Beach.