Maggots are the larva of a fly, generally the maggots we deal with are Housefly maggots. Though Houseflies are considered pests, most of the 250,000+ fly species are not pests but rather innocuous or even helpful. Even more, maggots play a very important role in the ecosystem as decomposers of dead matter (mostly they absorb nutrients from dead or rotten flesh).
Now, enough with the goodies. Maggots can be found in the most abominable places and are generally exposed to very dirty and unhygienic environments. Which is a reason many carry a lot of parasites and/or diseases. In this case though, the maggots in the dog food were limited to a space of a small can and are unlikely to carry diseases and/or parasites.
Maggots can actually invade a turtle's body. Signs of maggot infestment are holes in a turtle's skin or shell with black fluid oozing out. This happens if a turtle has wounds: Flies will land on it and lay eggs. Maggots should be removed by tweezers but can take a long time to be removed completely. When maggots are removed an antibiotic ointment should be applied daily. If you cannot see the maggots then you need to deprive them of air so they would come out to breath. You can do so by placing a gauze above the hole, then sealing it with a duct tape. After a little time remove the duct tape and a maggot should appear trying to breath, you should then pierce the maggot with a needle and remove it. Repeat this procedure until all maggots have been removed. Cleanse the area daily with a Betadine solution or mild salty water until the hole is healed. You might want to consult a vet before doing any of these and perhaps let them do it for you.
If the maggots are left for enough time, they can eat through the insides of the turtle and kill it. So just in case, keep an eye on the turtle while feeding it maggots in case the maggots find a wound you didn't notice and invade it. Maggots can be real evil!
Generally, salamanders, frogs, lizards, and turtles will readily eat maggots. Maggots are a good source of protein, but they also contain lipids. The proteins and fats are mostly high in amount but are actually extremely variable. Since these maggots were mainly feeding on dog food, which is relatively high in fats, then these maggots will probably have a very high fat content, which isn't good for the turtle.
In summary, turtles can eat maggots and yours probably will. However there are many better alternatives like crickets, meal worms, or superworms. Also, feeding maggots to your turtle poses unnecessary risks to the turtle's well being. I'd advise you feed maggots to your turtle only if they've been kept in a closed environment and were feeding on dead or rotten flesh that are low in fat. And if your turtle has been rejecting other food to a point were you know it's starving.