I know this post is a year and a half old, but I want to comment that your comma is correct and necessary. I don't know why you were told by others that it's not. However, you do not need to hyphenate 'three years old' in the way that you used it in the sentence.
When a sentence begins with a dependent clause ('when' is a subordinating conjunction here), a comma follows that dependent clause.
When I was three years old, I could tie my shoes. (comma is necessary)
Because I need to get in shape, I am going to start going to the gym three days a week. (comma is necessary)
If the dependent clause is at the end...meaning that the subordinating conjunction is in the middle of the sentence, then no comma is necessary.
I could tie my shoes when I was three years old. (no comma)
I am going to start going to the gym three days a week because I need to get in shape. (no comma)
Regarding the hyphenated age...
In your sentence, 'three years old' is a predicative adjective following the linking verb and describing 'I.' No hyphen is used when '___ years old' comes after the noun it describes. (When I was three years old,....)
However, if it is used as a noun (When I was a three-year-old,....)
or as an adjective that comes before the noun (When I was a three-year-old girl,....),
then you need to hyphenate it.
NOTE: These are not opinions, but rather correct English grammar that can easily be found on a number of reputable online sites. (Not all websites are created equal by the way.) I have numerous references if you need them. Additionally, I have a master's degree in Teaching English as a Second Language and have taught English for 14 years.