What is the box at the end of a USB cable?
Thats called a (molded) strain relief or enclose or case. Its to protect the wire connections from the cable to the connector inside. Its also for looks in case of the metal over plastic ones.
For basic usb cables it has no active circuitry inside. Some types of usb A cables do have circuitry inside the plug (Flash drives, USB to Serial/TTL adapters, chargers, led drivers, etc). Some of which are larger than normal but some which do fit inside the standardish sized case. You can even get some devices that fit almost entirely in the connector and it's shell, using the underside of the connector pins.
USB C (and Thunderbolt 3) cables are more likely to have circuits inside the case. E-marker chips are needed for high speed transfers and power delivery.