Car giant General Motors has filed for bankruptcy protection in the biggest corporate failure in US history.