Confused!

Be

The first date of my last period was 17.08.21 so I worked out my due date is the 24th May (40 weeks after). I went to an early scan and they said the baby is measuring 6 weeks one day and they told me this means the due date is the 10th June.

Is it 40 weeks from my last period or the day I ovulated/conceived? I’m so confused why it’s changed dates!