There are many theories explaining the history of Flamenco, and they are often contradictory.  I will explain what Flamenco is to me.  My view of the Flamenco is comes mostly from the dissection of the music itself.

Flamenco is a process and philosophy.  I feel that there a 4 types of music: Improvised (Jazz), Composed (Classical), Dance (Rhythmic), and Folk (Storytelling).  Flamenco is a combination of all of these types.

Flamenco serves the same function in society as blues; it is an art form used to express emotions, celebrate, and cope with the pitches that life throws at us.  It developed the same way as blues: by foreigners living in a land in which they were persecuted.

Flamenco is a process, with musical traditions rooted in ancient Gypsy culture.  Each individual piece is always based in song, and is usually based in dance.

Most people agree that the way Flamenco came about was from the combination of three primary cultures: The Gypsies (from India), The Moors, and the Jews.  Of course, the music was also influenced by native indigenous Spanish culture as well.

The music clearly reflects these cultures.  The repeating rhythmic cycles is characteristic of the heart-and-soul of Indian music and philosophy.  The melodic and harmonic sensibility comes from Arabic styles, and the chant-like song follows in ancient Hebrew traditions.