From the Document: "Foreign leaders are periodically invited to address Congress. The first address by a foreign dignitary occurred on December 10, 1824, when Revolutionary War hero the Marquis de Lafayette addressed the House. The most recent address took place on April 3, 2019, when His Excellency Jens Stoltenberg, Secretary General of the North Atlantic Treaty Organization (NATO), addressed a joint meeting of Congress. [...] When a foreign leader formally visits the United States he or she is sometimes invited to address Congress. The decision to invite a foreign leader to address Congress has historically been made by the congressional leadership, often in consultation and conjunction with the executive branch. No formal procedure, however, on when or how to issue invitations is codified in law or in House or Senate rules. Additionally, not all foreign leaders who visit the United States are invited to address Congress. When a foreign leader is invited to address Congress, the invitation is formally extended by the Speaker of the House on behalf of the House and Senate leadership."
CRS In Focus, IF10211
Congressional Research Service: https://crsreports.congress.gov/