Exhibit 5.1

Our ref JVZ/816789-000001/85639359v2
XCHG Limited
ICS Corporate Services (Cayman) Limited
Palm Grove Unit 4, 265 Smith Road, George Town
P.O. Box 52A Edgewater Way, #1653, Grand Cayman KY1-9006
Cayman Islands
29 June 2026
XCHG Limited
We have acted as Cayman Islands legal advisers to XCHG Limited (the "Company") in connection with the Company’s registration statement on Form F-3, including all amendments or supplements thereto (the "Registration Statement"), filed with the Securities and Exchange Commission (the “Commission”) and declared effective on 29 January 2026 under the U.S. Securities Act of 1933, as amended to date, the base prospectus included therein and the prospectus supplement dated 25 June 2026 (the “Prospectus Supplement”) relating to the sale of American depositary shares (the "ADSs") representing the Company's class A ordinary shares of par value US$0.00001 each (the "Shares") by the Company in accordance with the Securities Purchase Agreement dated 25 June 2026 (the “Sales Agreement").
We are furnishing this opinion and consent as Exhibits 5.1 and 23.1 to the Report of Foreign Private Issuer on Form 6-K to be filed by the Company relating to the Sales Agreement, which Report shall be incorporated by reference into the Registration Statement.
For the purposes of this opinion, we have reviewed only originals, copies or final drafts of the following documents:
1.1The certificate of incorporation of the Company dated 16 December 2021 and the certificate of incorporation on change of name dated 10 January 2022 issued by the Registrar of Companies.
1.2The third amended and restated memorandum and articles of association of the Company adopted by a special resolution passed on 22 July 2024 and effective immediately prior to the completion of the Company’s initial public offering of ADSs representing its Shares (the "Memorandum and Articles").
1.3The written resolutions of the board of directors of the Company dated 25 June 2026 (the "Resolutions").
1.4A certificate of good standing dated 26 June 2026, issued by the Registrar of Companies in the Cayman Islands (the "Certificate of Good Standing").
1.5A certificate from a director of the Company, a copy of which is attached hereto (the "Director's Certificate").
1.6The Registration Statement.
1.7The Prospectus Supplement.
The following opinions are given only as to, and based on, circumstances and matters of fact existing and known to us on the date of this opinion letter. These opinions only relate to the laws of the Cayman Islands which are in force on the date of this opinion letter. In giving these opinions we have relied (without further verification) upon the completeness and accuracy, as of the date of this opinion letter, of the Director's Certificate and the Certificate of Good Standing. We have also relied upon the following assumptions, which we have not independently verified:
2.1Copies of documents, conformed copies or drafts of documents provided to us are true and complete copies of, or in the final forms of, the originals.
2.2All signatures, initials and seals are genuine.
2.3There is nothing contained in the minute book or corporate records of the Company (which we have not inspected) which would or might affect the opinions set out below.
2.4There is nothing under any law (other than the law of the Cayman Islands), which would or might affect the opinions set out below.
Based upon the foregoing and subject to the qualifications set out below and having regard to such legal considerations as we deem relevant, we are of the opinion that:
3.1The Company has been duly incorporated as an exempted company with limited liability and is validly existing and in good standing with the Registrar of Companies under the laws of the Cayman Islands.
3.2The authorised share capital of the Company is US$50,000 divided into 5,000,000,000 ordinary shares of par value of US$0.00001 each, comprising (a) 4,258,745,553 Class A Ordinary Shares of par value of US$0.00001 each, and (b) 741,254,447 Class B Ordinary Shares of par value of US$0.00001 each.
3.3The issue and allotment of the Shares have been duly authorised and when allotted, issued and paid for as contemplated in the Registration Statement, the Prospectus Supplement and the Sales Agreement, the Shares will be legally issued and allotted, fully paid and
non-assessable. As a matter of Cayman law, a share is only issued when it has been entered in the register of members (shareholders).
4.1In this opinion letter the phrase "non-assessable" means, with respect to shares in the Company, that a shareholder shall not, solely by virtue of its status as a shareholder and in absence of a contractual arrangement, or an obligation pursuant to the memorandum and articles of association, to the contrary, be liable for additional assessments or calls on the shares by the Company or its creditors (except in exceptional circumstances, such as involving fraud, the establishment of an agency relationship or an illegal or improper purpose or other circumstances in which a court may be prepared to pierce or lift the corporate veil).
Except as specifically stated herein, we make no comment with respect to any representations and warranties which may be made by or with respect to the Company in any of the documents or instruments cited in this opinion or otherwise with respect to the commercial terms of the transactions, which are the subject of this opinion.
We hereby consent to the filing of this opinion as an exhibit to the Registration Statement and to the reference to our name under the headings "Enforceability of Civil Liabilities" and "Legal Matters" and elsewhere in the Registration Statement. In giving such consent, we do not thereby admit that we come within the category of persons whose consent is required under Section 7 of the U.S. Securities Act of 1933, as amended, or the Rules and Regulations of the Commission thereunder.
Yours faithfully
/s/ Maples and Calder (Hong Kong) LLP
Maples and Calder (Hong Kong) LLP