The calculator adds 280 days (40 weeks) to the first day of the last menstrual period (Naegele's rule). For cycles other than 28 days it adds the difference: (cycle length - 28) days. Pregnancy weeks are counted from the first day of the period, not from ovulation, so the first two weeks are "nominal". This is an estimate; your doctor or midwife sets the due date.
Ultrasound method: the calculator estimates gestational age from CRL (2 to 84 mm) with the formula: gestational age (days) = 8.052 * sqrt(1.037 * CRL_mm) + 23.73. According to ACOG (Committee Opinion No. 700, 2017), the due date is set from the last menstrual period, an early ultrasound, or both, and a pregnancy without an ultrasound confirming or revising the due date before 22 weeks is considered suboptimally dated. Your doctor sets the due date.