Swing was an important contribution to the jazz style of music. It was generally performed by big bands in the 1930's and was extremely popular with audiences. As the world changed, these bands broke up into smaller units. These smaller bands needed a slightly different style of jazz with fewer musicians. The limited number of performers made playing straight swing pieces difficult. This is where mainstream jazz evolved. Its roots are in the swing style, but performed by smaller bands.
Jazz has always been dependent on improvisation. Mainstream has kept the improvisational component, but has changed it. Rather than musicians improvising the melodic line, this style of jazz requires them to improvise the chords around the melody. The performers jammed together to recreate and support the melody in each piece. They did this while keeping the same energy and basic style associated with swing music.
Mainstream began to be popular with audiences as the big band era closed down, but its roots were within the big band era. Musicians that played swing in established bands often got together for informal jam sessions. A group of musicians often stayed together after their band broke up and played in smaller venues. The 1950's saw a revival of jazz and this was the popular style of jazz played at that time.
As jazz progressed, the mainstream style stayed with it. The 1970's and 80's were a popular time for mainstream jazz. Rather than staying with swing as their main inspiration, these bands moved with the time. Mainstream took elements of classic and hard bop into this unique style. Blues was also an influence to this style of jazz. It was considered a more relaxed style of music and fit those particular times. It is still an evolving form of jazz today.