What algorithm can solve the conversion engine problem?
In a union-find data structure, each item is either a root or points at a parent. For us, units will be items, and each pointer to a parent will be annotated with the appropriate conversion. You can maintain this annotation while running the usual operations on the union-find data structure.

Using this annotation union-find data structure, you can implement each add() using union and each lookup() using find, with only a constant factor overhead.