The answer is: the grand canal was first built.
The grand canal was first built when the Sui Dynasty held the power in the government, not the Ming dynasty.
Even though the building of the canal is started in Sui Dynasty, they still could not manage to complete the grand canal before their period of power is over. The construction of canal is taken over by the Yuan dynasty and people in Yuan Dynasty took the credit for the creation of the Grand canal.