Imagine you have a big mess in your room, with toys and clothes scattered everywhere. You might feel like you are not a good kid for making such a mess. But then, your mom or dad comes in, and instead of scolding you, they start cleaning up the room. They tidy everything up, putting away the toys and folding the clothes nicely. When they're done, the room looks perfect, even though you didn't do any of it yourself.
In a way, this is kind of what imputed righteousness means. It's like our Heavenly Father coming in and cleaning up our messes, even though we don't deserve it. When we believe in Jesus and his sacrifice for us, God sees us as perfect and clean, even though we still make mistakes and have flaws. He imputes or gives us Jesus' righteousness, sort of like he is covering us with a cloak of goodness that makes us seem perfect to him.
So, even though we know we aren't perfect, we can rest in the fact that God sees us as perfect because of Jesus, and we can try to live our lives in accordance with his teachings in gratitude for this gift of imputed righteousness.