One, because it was the perfect time for Obito to steal Kurama. Two, because he could use the opportunity to destroy Konohagakure, and stop them from disrupting his plans in the future. And third, chances are since the Curse of Hatred was making Obito lash out at Konoha, as the curse is stated to do.
He used the backlash from the attack to perpetrate the massacre.
Remember, in the novel adaptions, Obito was one of the reasons the Uchiha were pushing for the coupe, because he was manipulating Yashiro Uchiha.
This sort of makes sense, because besides looking at the tablet with his Mangekyo, which he could have done years ago, there was no reason for Obito to be in the village at that time, unless he was trying to cause the civil war between Konoha and the Uchiha.
However, it wasn’t his plan in mind when he attacked Konoha at first, because he didn’t plan to fail initially. Obito was lucky in that those who saw him during the attack died, so it left no witnesses, and thus, the Uchiha were placed under suspicion instead. So, it would seem Obito just made use of a failed plan to initiate another attempt to ruin Konoha.
Source → Naruto.answers