The lookup() is a function call used in data services which retrieves a value in a table or file based on the values in a different source table or file whereas a Table comparison transform is a transform which compares two data sets and produces the difference between them as a data set with rows flagged as INSERT, UPDATE, or DELETE i.e in simple terms you are comparing Source and Target table and asking the transform what exactly has changed(upsert).
You can use the lookup inside the query transform, mappings of columns.
Theoretically a lookup is similar to a SQL function call. A function takes one or multiple values as input and returns one (or multiple) value as output.
Table comparison is used for detecting Target based CDC
Hope the above links will be useful for you to understand Table comparison.