"花“ can be used as a noun, which means "flower", as you have already known. And "花“ can also be used as a verb and is similar to "cost/pay/take/spend" in English. It's subject could be person, object or situation. It's object usually is"time" or "money".
Eg1. This book cost me $5. 这本书花了我5美元。
Eg2. I paid $5 for this book. / I spent $5 on this book. 我花了5美元买这本书。
Eg3. It took me 2 hours to get to the airport./ I spent 2 hours getting to the airport. 去机场花了我2小时。or you can also translate it into "我花了2小时去机场” and this one sounds more natural in Chinese, though the former one is also correct.