I've been puzzling over why you would have a problem with name resolution. This has nothing to do with the problems you have when you use IP address.
I assume you are using something like Command-K from finder to type the Windows 7 machine name. So, "smb://machineName" doesn't work, but "smb://10.1.2.3" does. I also assume you're not appending ".local" to the machine name.
Is there any chance you set up your new machine on a different LAN segment from your Windows machine?
MacOS, unless I configure it otherwise in the nsmb.conf file, uses NetBIOS to do name resolution to find my Windows 11 machine. That should work fine when looking for a Windows 7 machine.
But, NetBIOS is broadcast based and, unless you're doing something fancy, is restricted to your local LAN segment. So if you have another network, reachable by IP address, but not on the same broadcast segment, then you would get the behavior you are experiencing. That could easily happen to me since I have multiple LAN segments in my house.
By the way, I can look up my Windows 11 machine using the name XYZ.local. That won't use NetBIOS; it uses mDNS instead. That would not work against Windows 7 unless you have some software (e.g. Bonjour) installed. I briefly thought your new Mac was trying to use mDNS to find your Windows 7 machine, but I see no evidence of that kind of behavior using Wireshark on my brand new Mac, unless I put ".local" at the end of the name. Apparently Microsoft is phasing out NetBIOS in favor if mDNS and I wondered if maybe Apple had jumped on that bandwagon too early. But that would have been ridiculous, even by Apple's standards of carelessness.