For 'photography' or 'taking pictures' substitute any X.
It's a confluence of three or four things, I am being vague about how many because the boundaries and definitions can be fuzzy, but anyway—
You need some talent, that is some innate ability, mental or physical; and it dosn't really matter if you care to think of that as a matter of pure chance, the right genetics, or the grace of god.
And then you need practice which therefore requires commitment and motivation and the opportunity to do so.
And opportunity can be a matter of being born in the right place and time —how many talenteted photographers has the world missed because they were born before the nineteenth century.
And motivation can be a vocation and thus come from within, or be a matter of encouragment or even necessity imposed from without —so we are back to the chances of time and place.
And I almost forgot, Education and Training: but then self-taught is a matter of motivation, and having a good teacher can be a matter of time and place etc.
So whatever you do, to do well you need: the serendipitous fertility of talent natured in a favourable time and place.
In other worlds so do, some don't.