Is it possible to connect two linux machine over a USB cable,
USB is an asymmetric protocol: You have a single host (the PC) at the center of the device tree, and many devices/clients. That's why have you USB-A (for the host) and USB-B (for the client) connectors. Unfortunately, the industry didn't follow this scheme, so there's an (unnecessary) wide variety of USB cables now.
You cannot directly connect two hosts together, that doesn't work, neither on the protocol level, nor electrically (and if you are unlucky, you'll fry the electronics this way).
That said, there are USB OTG ports (which can act both as host and client, but I've never seen one in a PC), and there's also an USB-C mode that in theory can connect hosts directly, but I doubt this is supported by the drivers, and I've never seen this working somewhere.
And why do people seem to not use this method?
Because it doesn't work. You can connect PCs directly with a LAN cable, or you can connect two Ethernet USB clients to each PC host port, and then connect the USB clients with a LAN cable. The "host-to-host USB cables" you can buy work this way, with the chips integrated into the cable.
TL;DR: Use either LAN or WLAN. It doesn't work with USB.