It's a juvenile Great Spotted Woodpecker.
Be careful - the beak and claws can draw blood.
If it's flwon into a window, leave it in the box overnight (with a lid on, somewhere warm and quiet), and then check it very early tomorrow morning. If it looks fine, let it go near some trees. If it still can't fly off, take it to a vet. Or you might find it's died.