Netflix is only possible on the Mac if you have a device with a T2 chip.
As Netflix writes on the own support pages, the essential requirement for a 4K stream is that the Mac has this security chip. So Netflix apparently does not consider macOS to be secure enough as an operating system and requires this hardware component in a Mac.
All recent MacBooks sold in the last few years have this chip, the iMac 27″ has the T2 introduced with the recent revision. The 21.5″ still does not have this chip, so it will never be able to play Netflix streams in 4K.
Besides the T2 chip, Safari is also required as a browser. A different browser is possible, but the resolution will then be reduced.