The most important thing that you need to understand is that the verb 'have' has two different functions. Here's the rule:
#1. Main verb
This is where 'have' carries the meaning of the sentence, usually possession ( I have a brother) and sometimes other meanings ( I have lunch at midday). If 'have' is the main verb of a sentence in a simple tense, you form questions - "Do you have a brother?" - and negatives with the auxiliary verb 'do', the same as for any other ordinary verb.
I don't have any brothers or sisters.
He doesn't have a car.
We didn't have a good time at the party.
#2. Auxiliary verb
'Have' is the auxiliary verb in perfect constructions, followed by the past participle. In these cases, it has a purely grammatical function, so you form questions with a simple inversion, 'Have you been to London?', and you form negatives by adding 'not' or 'nt', the same as for any other auxiliary verb.
I haven't been to London.
He hasn't done his homework.
We haven't had our dog for very long.
...
Simple, isn't it?
The most important exception to this very straightforward rule is the idiomatic construction 'I've got xxx'. If you say 'I've got a problem', this is an informal alternative to 'I have a problem'. The meaning is the same as #1, but the grammatical construction is the same as #2, so we form negatives by adding 'n't' : 'I haven't got a problem with that'.
You do sometimes hear people use 'haven't'/ 'hasn't' followed by a direct object, especially when there is an 'any' involved, e.g. 'I haven't any money', and in certain set phrases such as 'I haven't a clue'. This is more common in British English. I wouldn't worry about these expressions if I were you. Be prepared to meet them occasionally, but don't feel that you have to copy them. When you are using the language yourself, just say 'I don't have any money' and 'I don't have a clue', as this is the more common construction worldwide.
I hope that helps.