What you describe is extended desktop options instead of mirroring.
https://everymac.com/systems/apple/imac/specs/imac-core-i5-3.1-6-core-27-inch-retina-5k-2020-specs.html
Says:
"Details:*This model can simultaneously support the
internal display at full native resolution and up to one 6016x3384 (6K)
external display at 60 Hz with support for 1 billion colors; one
5120x2880 (5K) external display at 60 Hz with support for 1 billion
colors; two 3840x2160 (4K UHD) external displays at 60 Hz with support
for 1 billion colors; or two 4096x2304 (4K) external displays at 60 Hz
with support for millions of colors. It supports both extended desktop
(second workspace) and video mirroring (internal display duplicated on
the external display) modes."
So if this is your Mac, you need to make sure you are using a thunderbolt cable to ensure full capability.
USB-C cables may not support the resolutions you desire.