why is the president elected indirectly......?
Because we are not smart enough to do it ourselves :P hah no. the short answer is that the framers of the constitution did not trust direct democracy, and opted for a representative democracy.
When the framers, or creators of the Constitution, were setting up the democracy, they didn't think that citizens would have enough information about the candidates for presidency. Because of this, the complicated system known as the Electoral College was set up. However, the framers didn't foresee the establishment of political parties that rendered the system overcomplicated and useless.