Why are my Mac and Windows machine able to share a flash drive, but they cannot share an external hard drive?

The issue is not the type of external drive you use e.g. Flash Drive, Hard Disk etc but how the drive is formatted.

Windows and macOS can both read and write FAT and exFAT formatted drives. A flash drive defaults to one of these depending on its size.

By default Windows drives are formatted to NTFS. macOS includes (or perhaps used to include) a driver that allows these to be mounted and read but not written to. You can buy third party programs that allow writing to an NTFS volume from macOS. (There is an open source version but I am not certain that works with later macOS)

macOS will format a drive in APFS or HFS+. Windows can only read those with the help of a third party tool.

So if you want interoperability then you need a third party program or format the drive in exFAT. The downside of the FATlike formats is that the disk cannot hold metadata, for example owner, execution information and is not journaled so that you need to explicitly unmount the drive before removing it otherwise data could be corrupted on the drive.