This could be Blossom End Rot (BER) to which most of the cucurbit family are susceptible. It is caused by a calcium deficiency - see my answer here.
However, given that some of your courgettes are growing normally, and those that are rotting are very small, I think the problem is almost certainly caused by inadequate pollination:
No fruit, or fruit rotting when very small: This is a physiological problem, caused by the growing conditions, not a pest or disease. It is a problem when the weather in early summer is cool and this causes inadequate pollination.
Remedy: This is usually a temporary problem, and once the weather starts to improve, so will pollination. You can try to hand-pollinate plants yourself by removing a male flower (male flowers don’t have a swelling at their base) and brushing the central parts against the centre of a female flower (female flowers have a swelling at the base – this is the beginning of the fruit). But this is a bit of a hassle, and normally the plant will correct this problem itself.
Courgettes /RHS Gardening