That's because Cotton Guard can only be learned by Cottonee.
After evolving into Whimsicott, unless is already knew Cotton Guard, Whimsicott will never learn Cotton Guard.
The only possible way for it to learn Cotton Guard is to evolve while already knowing the move. So you missed your chance, sorry :/
Hope I helped!