CANBERRA, Australia—Australian Prime Minister Malcolm Turnbull said he had ordered an investigation into cyberattacks launched from overseas that thwarted the country’s first attempt at carrying out an online census.

Mr. Turnbull said the Australian Bureau of Statistics’s computer networks were shut down as a precaution after four...