Sonata form is a way of organizing a piece of music. It has been used in several pieces since the Classical period (from the middle of the 18th century onwards). Listening to pieces of music in sonata form will help to understand it fully and it is helpful to know something about the different keys.
Sonata form is not just used in sonatas. It can be the form for movements from symphonies, concertos, overtures etc.