Partitions in first place are required for these two reasons-
Each partition can have only one OS installed in it. Now coming to the primary partitions part and why they are only 4, we need to look at Master boot record or MBR. MBR has a size of 512 bytes. First 446 bytes consist of Initial program loader(IPL) which are essential for the boot process. Next 64 bytes consist of the partition table. Remaining 2 bytes are the magic bytes which point to the boot files on the hard disk.
Each partition that is made is recorded in the partition table. Each partition entry in the partition table needs 16 bytes. Hence 64 bytes table allows us to make only 4 primary partitions.
If we need more than 4 partitions, we move towards extended partitions. Since these partitions are extended form of primary partitions, hence the name.
Only one extended partition can be made. Three other partitions would be primary partitions, because anyhow the partition table would be able to handle only 4 partitions, so there would be 3 primary and one extended. Inside extended partitions we make logical partitions. As such, there is no limit to the number of logical partitions. In some books it is mentioned that logical partitions have a limit of 128, but I've personally made more than that on RHEL 7. There can be many number of logical partitions until the size allocated to extended partition gets exhausted.