STP - Learning State
STP uses various port states as part of the process to ensure a loop free Layer 2 topology. One of those states is the learning state.
The purpose of the learning state in the original STP is to prevent network loops during the transitional period when the spanning tree topology is still being established. By not forwarding frames immediately, the switch can avoid creating loops that could occur if frames were forwarded without a clear understanding of the network topology.
Why is it called the learning state? Because during this state, the switch is learning about the MAC addresses on the topology. Any frames that are received are used to populate the MAC address table before starting to forward frames.
The original STP places a port in the learning state for 15 seconds before moving to the forwarding state. Improvements in STP such as Rapid STP (RSTP) eliminates the use of a timer by using a request/response mechanism which allows for faster transitions. In this case, the learning state is almost instantaneous because the switch sends an RSTP proposal message immediately and receives one right away.
Links
https://networklessons.com/spanning-tree/spanning-tree-port-states