The Jewish law is like this, a woman’s first baby boy belongs to God. And after a baby boy is born the mother can’t go into God’s ceremony house or do any of their ceremonies for the next 40 days. It is like she is not clean. Then, after 40 days, she has to go to God’s ceremony house in Jerusalem, and kill 2 pigeons and burn them there, and let the smoke go up to God. This will make her clean again for Jewish ceremonies. So Joseph and Mary went to Jerusalem at the right time to follow that law. They took baby Jesus with them.