Bank was close to lining up $5bn for artificial intelligence group when US president and billionaire attacked each other