On the boldsky blog, Sanchita Chowdhury explains why Lord Ganesha is worshiped before beginning any task:
According to the yogic perspective, anything we do has to fall under one of the two categories: material or spiritual. It is believed that Lord Ganesha rules the ‘muladhara chakra’ of our body. ‘Muladhara’ is the interface between the material and the spiritual worlds. Lord Ganesha is said to control both these worlds. He is the one who gives the material enjoyments in this world and He is the one who liberates us from the endless cycle of birth and death. According to the yogic principles, our material life as well as our spiritual journey starts from the ‘Muladhara’ chakra which is controlled by Lord Ganesha. Hence, to complete our life cycle without any obstacles, we need the blessings of Lord Ganesha. Since He is the one who gets rid of all the obstacles from our lives, we worship Lord Ganesha before beginning any important work.