Anduril said it will build critical submarine parts for Virginia-class boats as it invests $3.7 billion in a new Maryland facility.