The early universe contained only the lightest elements, hydrogen and helium  Heavier elements, such as carbon, form only in nuclear reactions in stars and are dispersed when the stars explode
A recently discovered gas cloud contained carbon several billion years ago, when the universe was no more than two billion years old
Some stars were formed before the universe was two billion years old.