The answer is that, although they both identify a device on a network, they are used at different stages to control how data is transferred over a network.
One analogy is to consider posting a letter to someone. You would mark the envelope with the person's name and address.
The address helps the postal service find the right building. An address is structured - it tells the postman the country, town, district, street and house number, so that they can efficiently route the letter to exactly the right place.
Once the letter arrives through the letter box, the name becomes important. It needs to get to the right person within the house.
Imagine if you posted a letter with a name but no address? How would the postman know where to deliver a letter to John Smith, who could be anywhere in the world? It would be very difficult.
What if you posted a letter with an address but no name? Well, the letter would arrive at the right house, but how would anyone know who it was for? If your house only gets a few letters per day you might figure it out, but when it comes to millions of packets of data over the Internet it really needs to be ''automatically'' sent to the right device.
In this analogy, the house address is like the IP address. IP addresses are structured - for example, the first part of the address might let you know what country or company the data is destined for. The Internet can efficiently sent data packets to the correct place. In the case of a home network, all the data will arrive back at your Internet Network router.
The MAC address is like the name on an addressed envelope. Once data arrives at the router, the MAC address tells the router which actual device has requested the data, and the router automatically sends the packets of data to the correct device.
The IP address and MAC address operate at different levels in the [[TCP/IP layer model]]. One advantage of this is that the IP address is independent of the actual computer. So if you website lives at a particular fixed IP address, and the computer breaks, you can replace the computer without the rest of the Internet needing to know anything about it. The MAC address changes, but the new computer is still connected to the same IP address.
Copyright (c) Axlesoft Ltd 2021