You are describing a combined problem here. So let me split the answer.
It is not as easy for grass to root in dense clay soil as it is in loose soil, e.g. sandy soil (which has its own problems...). A lack of vigorous root growth means a lack of fast-growing grass. This often gives the moss a growth advantage and it then merrily takes over, resulting in lawn overgrown with moss.
It is therefore important to first loosen the area where you want to plant grass to a significant depth before sowing the lawn, to ensure that the lawn will thrive for many years. Heavy clay soils are loosened by adding a generous amount of sand (up to a third), which improves the structure, thus already making it easier for roots to penetrate.
If this overlooked soil improvement needs to be performed retroactively, landscapers specialised in lawn care can aerate compacted lawns, which allows air to penetrate. Special tools are used to perforate the soil with holes and these holes are then filled with coarse sand to ensure that they do not silt up again. This results in better drainage of surface water, and the grass roots get more oxygen - for better lawn growth. You can also aerate small stretches of lawn in back gardens or in problem areas (e.g. where the soil is particularly loamy and/or water does not drain) using a garden fork and shaking up the points of penetration until they are deep and large enough to top up with coarse sand. Doing this manually, though, is laborious as the holes must be close together - about five to seven centimetres apart.
As I said, this is a combined problem, hence the following word of advice on perfect lawn fertilisation. Besides the mentioned foundations for growth, optimal grass nutrition is also extremely important. Especially in view of your loamy soil, I recommend that you use a high-grade lawn fertiliser according to manufacturer specifications. This includes autumn fertilisation with a slow-release nitrogen so that the lawn survives the winter better and starts off on a healthier note the following spring.