Unfortunately unless there’s a plugin you can’t do this custom code (javascript) on wordpress.com – see “Javascript” section on this page.
You could do this on a self-hosted wordpress.org site using a plugin like this: Ajax Dropdowns
You might be able to use a form builder and then iframe it in to your page like Wufoo: https://www.wufoo.com/guides/conditional-logic-and-branching/, but again this code can’t have any javascript.