We ask [someone] a question. (perguntar)
• I asked [Joe] where he was going.
• I asked what time it was.
We ask for something. (pedir)
• I asked for more time to finish the exam.
• I asked for a sandwich at the café.
No, you are entirely correct! You need the "for", if you are requesting the name of a person. If you (illogically) ask the name itself a question, you would leave out the "for".
I don't know what difference there is between "o meu nome" and "por meu nome", but in English if you omit the "for", you are not asking the person, but the name, rendering such a question incorrect.
Example: "I didn't ask your neighbour" = I didn't give the neighbour a question. "I didn't ask FOR your neighbour" = I didn't tell someone to go and fetch me the neighbour.
By the way, "asked for" is accepted now!
It is true that "o" can mean "him" (or "it") but it can't be used after a verb without being tagged on using a hyphen ("Visitei-o" is "I visited him") and it usually appears before the verb ("Eu o visitei"). Here "o meu" means "my" and the "o" is optional in Brazilian Portuguese.
Both perdir and perguntar have noun forms. This is an easy way to remember the difference in the two words.
Pedir - to order, request
Um Perdido - an order ( as in an order in a restaurant or an online order)
Eu vou pedir a comida pelo telefone.
I'm going to order food over the phone.
Eu vou ao restaurante para pegar nosso pedido.
I'm going to the restaurant to get our order.
Perguntar - to ask (for information)
Uma Pergunta - a question
Posso perguntar quando essa igreja foi construída?
Can I ask when this church was built?
Alguém tem uma pergunta?
Does anyone have a question.
Eu posso fazer* uma pergunta?
Can I ask (fazer) a question?