Anything you do foolishly is something you'll probably regret later, because it's so unwise and silly. You'll smack your forehead in frustration watching your friend foolishly wash your car without rolling the windows up first.
When you act foolishly, you don't use your common sense. From foolishly riding your new skateboard down a flight of stairs to foolishly copying your friend's answers on the math test, these actions are the kind you usually wish you could take back. Foolishly is rooted in the Latin follis, "leather bag or bellows." The "silliness" meaning comes from a figurative "windbag," or ridiculous, insensible person.