I have a plastic compost bin. When I open the lid loads of earthworms fall down. Where do they come from? Are they on way in or way out?

I am looking for advice on how to create a compost heap, i have lawn cuttings, also this year i have planted a vegatable garden. Can i put old potatoe stalks, cabbage leaves, carrot leaves etc in to a compost heap. Should the compost heap have a concrete base.