They both refer to cooking food in a closed environment (think oven) by surrounding it with hot, dry air. The difference is the foods that are being cooked.
Baking typically refers to pastries, poultry cut into pieces and fish. Roasting is reserved for meat, vegetables and whole poultry. Back in the day, roasting meant cooking over an open flame, while the food was rotated for even browning. Today, foods are roasted by placing them in the oven at a relatively high temperature for even browning.
Here are a few exceptions. I’ve enjoyed baked potatoes, roasted fish and baked ham…go figure.