As you may know, MAC addresses and IP addresses exist on different layers of the ISO/OSI scheme or the TCP/IP suite. Make sure you understand the concepts behind these layers.
Note that the primary reason why we are using both IP and link layers is a historical one. It's mostly because IP addresses are 1) dynamic and 2) much more convenient to handle. Here's an interesting recent article that sheds more light on this history. Of course, it could have been different, but the Internet has evolved over decades, and it had to be backwards-compatible most of the time, so it's not like we could have come up with the best design from the start.
You're asking why we still use the MAC address to exchange data between devices on the same local network? Because:
- it's the only way you can actually unambiguously address a device that is connected to the same link (e.g., Ethernet)
- all communication has to pass through the link layer (MAC) anyway
You need to understand that because of the layered communication model, you can only address an end point at the same layer at which your protocol operates. For example, a TCP connection can only address a remote server with a certain IP address and port number. At the same time, TCP does not make decisions about how the underlying IP routing works. In other words, TCP doesn't care about—and is incapable of steering—how the IP protocol handles its connection data. The same goes for the IP protocol: it cannot decide where to physically send the data, but it doesn't have to, because there's the MAC layer.
The IP protocol is indeed used to uniquely address a certain device on your network, but when it's time for a switch to decide where to actually physically send the data (or the device itself when it has a MAC address cache), it needs to translate that IP address to the MAC address to which that IP address was assigned to.
With the massive address space that IPv6 offers, you could argue that MAC addresses are not needed anymore, because IPv6 offers both dynamic assignment and you can ensure that all assigned addresses are unique—but for several reasons (as explained in the article I linked to above), that's not what we're working with today.