As with most things Jesus taught about, the difference between doing something to please God, and legalism, is found in the heart. To have faith in Christ's saving grace one must have the knowledge that we are completely unrighteous without the atonement of Jesus, unworthy of receiving the gift of life Christ laid down for us. Responding to God in worship and obedience to His Word is evidence of our gratefulness for His gift to us. Legalism is focused on a system. Desiring to please God is focused on a relationship.
Legalism is focused on what is required.
Desiring to please God is focused on love from within. Desiring to please God is obeying His commands to love Him with all out hearts, minds, and souls. A Fruit Test Celebrating the holidays can become legalistic. So can going to church, wearing certain clothing, helping the poor, etc. Anything to earn righteousness or done for the outward appearances is legalism.