Last week, the President fired the Librarian of Congress, and then the Register of Copyrights, who is the Librarian's subordinate. I will set aside the question of whether that was a good idea, and focus on the legal question—how can the President fire the Librarian of Congress?
The answer appears to be that the Library of Congress is actually an Executive Branch department for legal purposes, though it also provides some services to Congress. Indeed, I think it has to be such a department in order to have the authority that it has over the implementation of copyright law (via the Register of Copyrights): As Buckley v. Valeo (1976) made clear, in a less famous part of its holding, Congress can't appoint heads of agencies that exercise executive powers.
Indeed, the U.S. Court of Appeals for the D.C. Circuit held last year,