Timbre (tone color) is the difference. While the formula for every musical tone contains the same elements (frequency, amplitude, etc) the difference is in how the tone is produced and the tuning of the instrument in question.
The guitar is tuned (in standard tuning) mainly in fourths. This allows many overtones to be produced and when a chord (3 or more notes simultaneously) is sounded, it "sounds" like more notes are being played. It is also plucked or strummed which makes it more akin to the lute, or even the harpsichord.
The piano is tuned chromatically to A (440 hz or thereabouts) for equal temperament. Where a guitar can completely change it's tuning or adjust with a capo to fit new keys (so the chord fingerings/tablatures are the same) the piano is in all keys. The piano "strikes" the strings with felted hammers to produce sound.
Instrument shape and material also affect timbre. Quick examples:
Flute/piccolo: air vibrating across an opening (think whistling or blowing across a soda bottle) made of metal sometimes wood. has an airy yet piercing and almost birdlike tone.
Clarinet: single reed vibrating against mouthpiece, made of wood. Sound exits the bell toward the floor, making it a mellow sounding instrument.
Saxophone: like above, single reed. Made of metal. Sound is omni-directional. Smooth and bright sound
Oboe/Bassoon: two reeds vibrating against each other. Made of wood. Oboe has bell toward the floor, but has a piercing nasal quality. Basoon has bell pointing up, still nasal but mellowed out a bit.
(French) Horn: sound produced by the players lips (embouchure) vibrating in the mouthpiece. Made of various metals. Rear facing bell, complicated by the right hand which provides more tone control has a very reserved/distant sound quality.
Trumpet/Trombone: same tone production as above. Made of various metals (mainly brass, but every type of metal has a different tonal quality) Front facing bells. Pretty much always "sticks out" and they don't really play well with others. Source:am trombonist
Tuba/Euphonium: same tone production as above. Made of metal. Like bassoon, upward facing bell produces a smooth mellow sound.
There are countless minutae that go into why x sounds like x (type of mouthpiece, composition of mouthpiece, shape of embouchure, thickness and quality of reeds, tongue placement, breath quality and management, posture etc etc ad infinitum) but hopefully this helps.