Hi,
Windows Disk Management cannot extend C: into non-contiguous unallocated space because it only works with adjacent partitions. If your unallocated space is after D:, you have two choices:
Delete or move D: so the unallocated space becomes next to C:.
Use a third-party partition manager to safely move partitions and extend C: without losing data.
The easiest and safest method is using a trusted partition manager. Let me know how it goes, Happy to help!