After shutting down they still have momentum. Or like you said, because of Windmilling - freely turning when the windswind impacts the compressor blades.
The APU can, but more often than not doesn't, rotate the engines (overly simplified, not to go into unrelated details).