Summary:
Great Artists, Engineers, Merchants and Scientists are created in cities by specialists and Wonders which generate "Great People" (GP) points. A city may generate no Great People points, or it may generate a single kind of GP points or it may generate multiple kinds of GP points. Each city's GP points are kept track of separately. (For example, Kyoto might generate 1 Artist and 2 Engineer GP pts each turn. After 3 turns it would have 3 Artist points and 6 Engineer GP pts. The two types of points are not pooled.)
When a city has enough of a specific type of GP points, the points are expended to generate a Great Person of that type. Once a Great Person is generated, the amount required for the next Great Person increases in all of that player's cities.
For instance, let's say that a player needs to acquire 10 GP pts to get a Great Person. From the previous example, in five turns Kyoto would have enough Engineer GP pts. to create a Great Engineer. After the Great Engineer was created, Kyoto would have 0 Great Engineer points and 5 Great Artist points left, and the amount required for the next Great Person would increase to say 15 points. Eight turns later Kyoto would have 13 Great Artist points and 16 Great Engineer points, and it would generate another Great Engineer.
Note that a Garden building increases the rate at which you generate Great People, and that the "Warrior Code" social policy immediately generates a Great General.
Additionally, once you advance into the Industrial Age, you will be able to expend unused Faith to purchase Great People, depending on what Social Policy branches you have open (Great Merchant for Commerce, Great Scientist for Rationalism, Great Artist for Freedom, Great General or Great Admiral for Autocracy, Great Engineer for Order).