Her story likely has some folk-traditional roots, but is also probably a stylized composite of a number of virgin martyr tales. It seems to be popular in some scholarship today to suggest that her story is based on that of Hypatia, but this is extraordinarily implausible, both in terms of the structure of her legend and in terms of historical influence, and I have never seen any argument for the claim that is even remotely tenable; it seems to me very likely that the historians proposing such things are doing a stylized composite of their own.
From the Caxton translation of The Golden Legend:
First she appeared marvellous in wisdom, in her was all manner of philosophy. Philosophy is divided in three, in theory, in practice, and in logic.
Theory is divided in three, that is intellectual, natural, and mathematical. The blessed Katherine had science intellectual in knowledge of things divine, of which she used against the masters, to whom she proved to be but one very God only, and convanquished all the false gods. Secondly, she had science natural of which she used in disputing against the emperor. Thirdly, she had science mathematical, that is a science that be holdeth the forms and the manner of things, and this science had she in despising the earthly things, for she withdrew her heart from all earthly matter. She showed to have this science when she answered to the emperor, when he demanded who she was, and said: I am Katherine, daughter of king Costus, and how she had been nourished in purple. And hereof used she when she enharded the queen to despise the world and herself, and to desire the reign perdurable.
The practice is divided in three manners, in ethic, economic, and politic. The first teacheth to inform manners and adorn him with virtues, and that appertaineth to all men. The second teacheth to rule and govern well his meiny, and that appertaineth to them that have men to govern. The third appertaineth to the governors of cities, for she teacheth to govern the peoples, the cities, and the commons. And these three sciences had the blessed Katherine. First, she had in herself all honesty of manners; secondly, she ruled her meiny laudably, which was left to her, thirdly, she informed wisely the emperor.
Logic is divided in three, in demonstrative, in probable, and in sophistical. The first pertaineth to philosophers, the second to rhetors and logicians, and the third to sophisters, and these three sciences had Katherine in her, for she disputed with the emperor.