When was Android Developed

In Basic Android App Development you told that Android was developed in 2009 and also the first version of Android was released on 5 November 2007, so what exactly do you mean. When was actually Android Developed in 2009 or 2007 because if in 2009 Android was developed so the version of Android release later after 2009 how it can be release first and developed later.