Tor uses onion routing while I2P uses garlic routing. What exactly is garlic routing and how is it different from onion routing?
Garlic Routing is a variant of Onion Routing which I2P (Invisible Internet Project) uses. The fundamentals of garlic routing and garlic encryption were developed by Michael Freedman and were improved and implemented by the developers of the I2P project. It encrypts multiple messages together to make it harder for attackers to analyze traffic. To protect the identity of the sender, messages are encrypted several times with the public keys of selected nodes on the network. To be given, the secure packets must be received by routers selected by the sender, in the order provided by the sender. Unlike onion routing, an encrypted packet can contain multiple packets (garlic cloves) with different destinations, and the sender is not required to specify a return path for the message.
Image source: https://www.slideshare.net/devil_15/overlay-networks
Image source: https://www.hindawi.com/journals/scn/2019/9078176/
Image source: https://geti2p.net/en/docs/how/garlic-routing
Additional resources to understand Garlic Routing: