The authority, exactly
The General Department of Immigration is competent for both steps, but the steps happen in a fixed order and at different times: it decides the temporary authorisation to stay before you travel, and it decides the residence permit itself only after you have entered Luxembourg, registered your arrival with your commune and completed the medical check-up. Communes handle the declaration of arrival; the National Employment Agency (ADEM) issues the certificate your employer needs before the temporary authorisation can even be requested.