Switches store the MAC to port translation mapping in a table know as MAC table. It is also known as CAM table. What does CAM stand for?
Content Addressable Memory (CAM) is the store of the MAC addresses of devices on a Local Area Network (LAN). It is used in multilayer switching to quickly switch the path of frames to reach their destination (as provided by MAC address)
For more information, see: https://www.packet6.com/cam-table-fundamental-switch-operations/