QuickLinks -- Click here to rapidly navigate through this document


Exhibit 5.1

[Cooley Godward LLP Letterhead]

December 17, 2003

Aerogen, Inc.
2071 Stierlin Court
Mountain View, CA 94043

Ladies and Gentlemen:

        You have requested our opinion with respect to certain matters in connection with the filing by Aerogen, Inc., a Delaware corporation (the "Company"), of a Registration Statement on Form S-3 (the "Registration Statement") with the Securities and Exchange Commission covering the offering for resale of 304,878 shares of the Company's common stock, par value of $0.001 ("Common Stock") (the "Conversion Shares"), issuable upon exercise of a convertible debenture (the "Debenture"), issued in connection with the Loan and Securities Purchase Agreement, dated September 9, 2003, by and between the Company and SF Capital Partners, Ltd. (the "Purchase Agreement") and 152,439 shares of Common Stock (the "Warrant Shares") issuable upon the exercise of a warrant for the purchase of Common Stock (the "Warrant"), issued in connection with the Purchase Agreement.

        In connection with this opinion, we have examined the Registration Statement and related Prospectus, the Company's Amended and Restated Certificate of Incorporation, as amended, and Bylaws, as amended, the resolutions adopted by the Board of Directors of the Company on September 5, 2003, and such other documents, records, certificates, memoranda and other instruments as we deem necessary as a basis for this opinion. We have assumed the genuineness and authenticity of all documents submitted to us as originals, the conformity to originals of all documents submitted to us as copies thereof, and the due execution and delivery of all documents where due execution and delivery are a prerequisite to the effectiveness thereof.

        On the basis of the foregoing, and in reliance thereon, we are of the opinion that the Conversion Shares, when issued upon conversion of the Debenture in accordance with the terms of the Debenture, will be validly issued, fully paid and nonassessable and the Warrant Shares, when issued upon exercise of the Warrant and payment therefor in accordance with the terms of the Warrant, will be validly issued, fully paid and nonassessable.

        We consent to the filing of this opinion as an exhibit to the Registration Statement and to the reference to our firm under the caption "Legal Matters" in the Prospectus included in the Registration Statement.

Sincerely,
         
COOLEY GODWARD LLP

By:

 

/s/  
ROBERT J. BRIGHAM      
Robert J. Brigham

 

 



QuickLinks