The trumpet is not used just for jazz. Classical music (think Bach, Beethoven, Vivaldi, etc.) also uses the trumpet. It has a rich sound, which adds to the idea of a musical piece and gives it better and richer tones, depths, etc. Jazz has simply become the most popular thing for trumpeters to learn, since it was jazz that made the trumpet’s name. Trumpeters like Dizzy Gillespie and Louis Armstrong are well known for their jazz pieces, which has helped to make people unaware that, yes, the trumpet is used in other kinds of music.
Famous trumpet pieces that are not jazz include, but are not limited to, the following: Joseph Haydn’s trumpet concerto (arguably the most well-known classic trumpet piece) and Zimmerman’s “Nobody Knows the Trouble I’ve Seen.”