Hello Yoko san.
I'm an English learner from Japan. You too? The usage of English indefinite article 'a' is quite troublesome for us Japanese to get, because in our native tongue we don't use a word like English 'a' to modify/define countable nouns.
I think English speakers use 'a/an' basically in three ways.
(1) Used just to mean 'one' in a weak sense. In this use, 'an apple' might be paraphrased into ''an unspecified apple', or 'a not-particular apple'.
(EX-1) I ate an apple at the end of lunch and then I went out shopping with mother..
(2) Used to introduce a thing/a person which the speaker/writer wants to focus the hearer's/reder's attention on. In this sense, 'an apple' might be paraphrased into 'a certain apple'.
(EX-2) At the end of lunch I ate an apple. It was really delicious! I was very contented with the lunch.
What is important for this usage is you have to put some explanation about the thing you introduced.
(EX-3) I like a dog. His name is Mikky. I bought him last December for $50 at a pet shop nearby.
(EX-4) I like a dog. I like a cat too. But I like a dog better than a cat.
The EX-3 sounds not weird to me, but the EX-4 sounds weird. It would be better to say: "I like dogs. I like cats too. But I like dogs better than cats."
(3) Used to say something in a generic sense. This 'a' could be paraphrased into 'any'.
(EX-5) A dog is an animal. A cat is also an animal.
Usage of 'a' of this kind often appears in encyclopedia's articles and
of this usage usually comes at the subject position.
paco