Address Resolution Protocol (ARP) is used to map network layer addresses (IP addresses) to data link layer addresses (MAC addresses). This process is necessary because communication between devices on a local network uses MAC addresses, while routing and forwarding between networks uses IP addresses. ARP works by broadcasting a request packet containing the target IP address, and the device with that IP address responds with its MAC address. If the MAC address is unknown, ARP uses a broadcast query to determine the address dynamically, while direct mapping provides a way to statically determine addresses through a formula.