pregnant 🤰

A month and a half ago I didn't have my period so I took a pregnancy test it came back negative but my stomach has started to get bigger (I'm on a diet and have been working out.) I took another one last week it back positive. I went to the doctor today and I'm 2 months pregnant 🤰. Why did it not positive the first time I took a test? Any ideas?