What is the grammatical function of "se" here? Is it a COD ou COI? Which one is correct?
elle s'est faite mal.
ou
elle s'est fait mal.
It is a COI: the phrase means literally "elle a fait mal à elle-même".
The correct form is therefore elle s'est fait mal.
Here, both sentences are correct in French. Although they are similar, they don't mean the same thing.
Elle s'est faite mal
Would mean that she made herself wrong rather than she hurt herself, which is the correct meaning for the second sentence.
Though the first sentence is logically eccentic (as someone cannot make himself wrong?), it is French-speaking correct. However, to be honest, we would rather say elle s'est mal faite if we want it to be 100% correct.