Rotted wood is almost inevitable in wood trim or any wood that's subjected to the elements. To test wood for rot, tap it with a dull knife or a screwdriver. If the wood feels very soft or is crumbly, it's rotted. If the area of rot is less than fifty percent of the total area of wood, you can repair it with a well known substance available at any auto parts store..
Use the screwdriver and chisel to remove the very crumbly wood, down to reasonably sound wood. If you poke it with a screwdriver and pieces still fall off, remove more. Vacuum the area to remove dust and other small pieces of wood.
Open a can of auto body filler and spread it over and into the rotted wood. Use a putty knife and push it into all of the cracks and crevices.
Allow the auto body filler to dry completely. Then sand the area to match the shape of the original wood.
Prime and paint as you do with normal wood.