What is Hamlet's purpose in in talking to Polonius about the sun's breeding maggots in a dead dog? And why is the company of players traveling about?
Hamlet, I think, is pretending to read from his book, but - as with many of his other mocking comments to Polonius in this scene - he is making a reference to Ophelia.
"Carrion" can mean either dead flesh, or living flesh. What Hamlet feigns to read is the information that the sun can cause maggots to appear in flesh left outside to rot (It's an odd Elizabethan idea that the sun bred all life - now disproved!).
What the coded meaning is is that the son (that same pun Hamlet made in his first scene) might also breed (i.e. have sex with) another sort of "kissing carrion" - a sort of flesh available for sexual pleasure. As the sun breeds maggots in flesh, so might the son breed something else in another kind of flesh... and then he asks "Have you a daughter?".
Though ms-mcgregor is right to assert that, in the early Elizabethan days, many touring companies would tour, it's important to point out that, when Hamlet is written (around 1599) that was less true. Shakespeare actually gives us the reason for the players travelling later in Act 2, Scene 2.
Hamlet asks "How chances they travel?", and Rosencrantz tells him that they don't attract as big audiences as they used to, as a company of "little eyases" (young child actors) are in fashion on the stage. So the players have been forced to tour to make money.
Two excellent questions there! Hope it helps!
Hamlet's purpose in talking to Polonius is to mock the old man but Polonius really doesn't get it. In Act III, Scene 2, Hamlet first calls Polonius a "fishmonger" or a pimp. Hamlet is really saying that Polonius is trying to "sell" his daughter, Ophelia, to him. Then he makes his comment about the sun and maggots followed by "Have you a daughter". When Polonius says yet, Hamlet adds,"Let her not walk i' th' sun. Conception is a blessing,/but not as your daughter may conceive. Friend, look to't. Many critics think this is a play on words between the word "sun" and "son". They believe Hamlet is referring to himself as the sun/son and making a rather vulgar insinuation about Ophelia. However, Polonius never understands the pun.
To answer the other part of your question, the company of players is doing what most actors did during Elizabethan times. There were very few standing theaters ( the Old Globe was London's first) and so actors had to travel from place to place in order to find places to earn money by performing.
To save confusion and in the interest of accuracy, I wanted to explain that the conversation the response below refers to (starting Hamlet's comparison of Polonius to a fishmonger) is found in in Act II, Scene 2, line 175, not in Act III. At this point, Polonius comes upon Hamlet reading and the players are not even present. It is in Act III, scene 2 that a conversation takes place between Hamlet, the players and Polonius.
As for the question about maggots, "spontaneous generation" was a common (yet totally false) scientific theory going back to as early as the middle ages. People believed that maggots were already there, present in the flesh, and they sort of "sprouted" to life of their own accord once sunlight hit a decaying corpse. Hamlet warns Polonuis that Ophelia needs to be closely looked after, since she doesn't really even have to do anything at all to get pregnant. He asserts that all she has to do it walk around in public and it will spontaneously happen. As with the maggots, Eve's original sin is already inherent at birth in all female flesh, so that babies will be generated by the simple act of walking around in public where men's eyes can touch or "kiss" their flesh. This comparison illustrates that Hamlet has no faith in female virtue. Instead, he points out the frail, fickle, easily corruptable nature of woman. He thinks the only way to maintain female virginity is to forcibly lock them up (hence the reference to nunneries). This ties in with one of the play's themes: mistrust (and perhaps hatred) of women. Gertrude's actions so taint Hamlet's outlook that he can only see women as whores. Desite all this, I think he still truly loves Ophelia, even while he enjoys mocking Polonius and hinting about his own desire to deflower her.
The company of players are traveling around to make money, as would be common at that time. Bands of traveling entertainers were something a village would anticipate and welcome--just think about how boring life in a castle estate would have been. A permanent structure for performing drama or music before a crowd (like Greek ampitheatres or even Shakespeare's Globe) was such a rarity at this time that for the most part it just didn't exist. In addition, these players mention that that they were pretty much forced to leave because of the new craze for child actors in the city. No one is coming to see them anymore so they are forced to leave to make a living. They're traveling for the same reasons musicians tour today: for profit and self-promotion.
Hope this isn't too simplistic...
As well as all the above discussion about double meanings, I think we better make sure you understand the simple meaning. Remember that we are reading a play written 400 years ago. In those days, their knowledge of science was practically nil. They thought maggots simply appeared in dead flesh as part of the corrupting process of decay. So the sun is the creator of maggots in dead flesh because the heat of the sun makes meat decay and so it appeared to 16th minds that 'the sun breeds maggots in a dead dog'. So he is 'madly' suggesting that if Ophelia walks in the sunshine, she may also breed maggots. (Which he then links to conception and you can play double-meanings with 'sun' and 'son'.)