tempdb is a system database used for holding temporary objects that can be user created or system created. Unlike other databases, tempdb is recreated every time SQL Server starts. The various uses of tempdb can be generally categorized into three groups: user, internal, and version store objects.
User objects: Used for objects created directly by users like global and local temporary tables, table variables, or temporary stored procedures.
Internal objects: Used for internal objects including worktables to store temporary data for sorting, hash tables, ...