Tanks are designed to fight every threat while Tank Destroyers are purpose-built machines for the sole purpose of destroying enemy tanks, in basics.
Tank destroyers were designed purely for the purpose of destroying enemy tanks. Their main distinguishing features include the majority of them lacking turrets and carrying much larger and more powerful guns. The larger and heavier armament is one of the main reasons why they tend to lack a turret, having gotten rid of it during the design. This also has the added benefits of reducing the profile of the vehicle, thus increasing concealment.
Obviously, there were Tank Destroyers with turrets, most notably the American TDs, but the majority lacked a turret. This, however, came at the cost of being able to mount smaller weaponry with the largest being a 90mm on the M36.
Oddly enough, tank destroyers can also include AFVs that aren’t necessarily “tank-like”, such as the American M3 GMC, which was basically a truck with an anti-tank gun mounted on it.
It should also be noted that the concept of the Tank Destroyer pretty much died out by the end of the Second World War. This is primarily due to the rise of a universal tank or the Main Battle Tank concept.
Tanks, on the other hand, are designed to combat everything. In WW2 this wasn’t always the case but from the Cold War onward the Main Battle Tank(which meant a tank capable of dealing with all threats) concept became standard. This concept was able to be utilized due to the rapid technological advancement, that allowed for heavier armor and armament, while still being able to maintain decent mobility.
It was primarily the Main Battle Tank concept that killed the Tank Destroyers. MBTs were now able to do everything Tank Destroyers could while being more versatile and better able to support infantry. Other factors that killed the concept of the Tank Destroyer included the fielding of ATGMs(Anti-Tank Guided Missiles) which could do the same job while being much more reliable and cheaper as well.
Tanks are versatile machines designed to take on any kind of threat, while Tank Destroyers are inflexible machines that specialize at killing enemy tanks resulting in them being far less capable of dealing with other threats.