This answer is for LTE standard, not 5G NR. However I do believe that the basic concept does not change since.
(Logical) Antenna port is defined formally as in 3GPP 36.211
An antenna port is defined such that the channel over which a symbol on the antenna port is conveyed can be inferred
from the channel over which another symbol on the same antenna port is conveyed.
This simply means that symbols that are transmitted over an antenna port are
subject to the same propagation conditions. Hence to determine the characteristic channel for an antenna port, a separate channel estimation for each antenna port needs to be done. That is the reason why an antenna port is characterized by its Reference Signal.
To the best of my knowledge, each antenna port has its own resource grid that is mapped directly to the corresponding physical antenna port. Then if two antenna ports are mapped to the same physical antenna port, their resource grid are summed up. There will be reserved resource elements to avoid inteference between antenna ports.
The four first antenna ports (1-4) are normally mapped 1-1 to physical anntenna ports. And it is possible to have two antenna ports mapped to one physical antenna port. For example, antenna port 5 can be mapped to the same physical antenna ports of (logical) antenna ports 1-4.
It is also possible that one (logical) antenna port is mapped to two (or more) physical antenna ports. It is the case of beamforming that requires several physical antennas to create a beam that is characterized by UE-RS. The beamforming effect is transparent to UE and UE only sees one resource grid estimated by its UE-RS.
This white paper can provide more useful details.