They look alike and I'm not exactly sure what's the difference
They look alike because they use the TO-220 package.
TO stands for "Transistor" "Outline" and Number 220 is the "outline" or package "design", meaning it adheres to specific dimensions.
The only way you know "what goes on inside" is to, for example, "Google" for a DATASHEET based on the stamped part number.
7812 - Motorola MC7809 datasheet pdf
TIP122 - HTTP 301 This page has been moved