Does anyone know of a good book on the history of imaginary numbers and complex analysis and its role in physics?
I would say that there is no good book which satisfies your description. The Book of Bottazzini and Grey mentioned in the comments is OK, but it certainly does not cover the role of complex analysis in physics. A better book is J. Dieudonne, Abrégé d'histoire des mathématiques 1700–1900, Hermann, Paris, 1978, in 2 volumes, both volumes have chapters on complex analysis. Unlike Grey and Bottazzini, Dieudonne was an outstanding mathematician himself, so he better understands the subject and its history. But it also does not cover interaction with physics.