Interstellar comets offer direct samples of volatiles from distant protoplanetary disks. 2I/Borisov is the first notably active interstellar comet discovered in our Solar System1. Comets are condensed samples of the gas, ice and dust that were in a star's protoplanetary disk during the formation of its planets, and inform our understanding on how chemical compositions and abundances vary with distance from the central star. Their orbital migration distributes volatiles2, organic material and prebiotic chemicals around their host system3. In our Solar System, hundreds of comets have been observed remotely, and a few have been studied up close by space missions4. However, knowledge of extrasolar comets has been limited to what could be gleaned from distant, unresolved observations of cometary regions around other stars, with only one detection of carbon monoxide5. Here we report that the coma of 2I/Borisov contains substantially more CO than H2O gas, with abundances of at least 173%, more than three times higher than previously measured for any comet in the inner (<2.5 au) Solar System4. Our ultraviolet Hubble Space Telescope observations of 2I/Borisov provide the first glimpse into the ice content and chemical composition of the protoplanetary disk of another star that is substantially different from our own.