I was wondering if it is mandatory for it to be named after a saint or optional?
It's not even the fullest part of the suggested course at most churches. The fullest part of what is normally suggested is that one either picks the name of a saint or a virtue (e.g. Patience, Chastity, Hope, Faith, Courage, Wisdom, etc.). A common and very-much-encouraged divergence from this is to choose someone in your life (typically a dead relative) who inspired you to follow Christ with their example. This is really very similar to being named after a saint, as the Church professes that the greater number of saints are not found in the earthly records. Other people (though this is, obviously, less good) just pick a name they like. The Church reserves the right of judgement over your choice of name (you probably can't get confirmed an obscenity), but anything you pick will probably be allowed unless it's obviously offensive or sacrilegious in some way.