The 8P8C connector (commonly known as RJ45, even though this is incorrect) is used for a lot of different things.
While nowadays its most common use is for (some kinds of) Ethernet, it can also be used:
- For RS-232 or other similar serial ports (instead of the more common DB-25 or DE-9 connectors), especially for console access on Cisco routers and other devices;
- For analogue telephony (aka POTS);
- For digital telephony (aka ISDN);
- For proprietary telephony systems;
- Sometimes even USB;
- And many other things.
The adapter you bought is for the first type: to connect to an RS-232 serial port presented as 8P8C (RJ45). It is completely unrelated to Ethernet.
What you need is a USB Ethernet adapter. They come in many different shapes and sizes, and have varying characteristics and performances (100 Mbit/s, Gigabit, 2.5GbE, USB 2, USB 3, USB-A, USB-C...). You need to make sure the description of the product includes "Ethernet", along with the specs you want.
Some docks (especially USB-C docks) also include Ethernet ports, so it may be an alternative if you need other interfaces (more USB, HDMI, etc.).
If your computer has a USB-C port, you're probably better off using an adapter using that kind of port. Given the low prices of such adapters, picking a 2.5GbE adapter is probably a good idea even if you won't use it at its maximum potential if your switch/router doesn't support such speeds.
While there are a few adapters that take the form of a cable (with a male "RJ45" at the other end like the one you bought), most will have a female connector, and you will then need an Ethernet cable to connect that to the corresponding connector on your switch or router. The advantage is that you can easily change the cable if you need shorter or longer distances (or if the cable or plug gets damaged).