I have a white cocoon type nest in a small apple tree in my backyard. I can see small bugs inside and I want to kill them before they hatch.
When you say 'bugs' I'm assuming you mean larvae, because it sounds like a tent caterpillar infestation. Its easier to wait until the egg masses are laid at the end of summer or in fall and scrape those away, but removing the tents is possible - but best done before the larvae start to feed. the commonest one is Eastern Tent Caterpillar, though it depends where you are which ones you have. More info here
I used to get horribly complicated with these - rural legend had it that you had to cut of the infested branch and burn it. This legend was probably sustained by boys who liked to play with fire.
An entomologist friend laughed and said all you need to do is rip the webs open and let birds take care of them.
If you have webs, and things moving, you (likely) have caterpillars, not eggs.