The Trumpet and Cornet are similar. They are both members of the "brass" family of instruments. This means they are played the same way - through a very similar mouthpiece. You get a sound by "buzzing" your lips in the mouthpiece.
Both trumpet and cornet have three valves. They both consist of approximately 4.5 ft. of wound tubing. And they are both tuned the same way. Standard models are pitched at Bb relative to concert pitch.
The cornet appears to be shorter than the trumpet, but that is because the tubing is wound in a tighter pattern.
More importantly, the "bore" of the trumpet (i.e., the diameter of the tubing) is different. On a trumpet the tubing is the same diameter from the mouthpiece to the point at which the bell starts to flare out.
On a cornet the "bore" starts out a bit smaller at the mouthpiece and gradually increases throughout the full length of the tubing, until it flares out at the bell. This gives the cornet a warmer, softer sound more akin to the human voice.
The trumpet, on the other hand has a more brilliant, brighter, and some would say, more piercing sound.
Popularity and Usage
Cornets have traditionally been more widely used in British military inspired Brass Bands where they are paired up with other brass instruments.
Trumpets are more typically used in orchestras, jazz bands, and ensembles where they provide the upper range "punch", and serve as solo instruments.
Trumpets became more popular in the early to mid 1900s with the popularity of professional players such as Louis Armstrong, Harry James, Miles Davis, Al Hirt, Bert Kaempfert, Herb Alpert, among many others.
Which one should I play?
Children often start on cornets because they are a bit smaller and lighter, but this is quickly changing as lighter plastic-based trumpets are becoming more available and more reliable.
If you play in a jazz ensemble or high school band, you'll probably choose a trumpet (or it will be chosen for you.) If you like jazz or dixieland music, or have a flair for soloing, you'll also probably gravitate fairly quickly to the trumpet.