This article - https://omarshehata.me/notebook/exploring_sound - explains why different instruments sound different, despite playing the same note. It is so fascinating.
Long story short, the sound that an instrument produces when it plays a particular note consists of many frequencies, not just one. The strongest constituent frequency - the dominant frequency - in the sound wave is what determines which "note" is being played, but the other constituent frequencies are also heard, and contribute to the sound the instrument produces. That is why a piano and violin sound different, despite playing the same note - the non-dominant frequencies of each instrument are different. Those non-dominant frequencies are still heard, and produce the characteristic sound for each instrument.