Welcome to your 40s!
Really, it's likely genetic. Hair's depth of color is determined by both genetics and certain minerals. A deficit in some minerals may lead to greying, while genetics definitely will.
I started noticing a few stray white hairs when I was in my 20s. I have a patch in my beard that seems to gain another white hair every so often.
Some people go grey slowly, while some others turn quickly. My grandmother had two grey stripes in her hair when she was in her mid-30s, for example. But I have also seen some people whose roots seemed to just start growing out greyer at some point, and in the course of a year, was all growing grey.
Also, the change can be more dramatic in shorter styles, as the older hair is trimmed away more frequently, leaving the newer growth exposed.